Search Unity

Fast moves in Unity

Last updated: November 2018

What you will get from this page: A number of shortcuts that add up to a lot of time saved.
Yilmaz Kiymaz, a veteran Unity game developer at InnoGames, has a few choice tips to help you speed things up. He covers topics such as menu items shortcuts, ways to automate workflows and how to reduce computation times. Thanks Yilmaz!

Shortcuts in the Editor

A few highlights include:

  • New GameObject: Cmd/Ctrl + Shift + N
  • GameObject.SetActive: Alt + Shift + A
  • Add Component: Cmd/Ctrl + Shift + A

For a comprehensive list see this page from the docs. And here are additional shortcuts in Project Window.

Shortcuts for menu items

If you have a menu item without a shortcut you can use EditorApplication.ExecuteMenuItem. Or, create your own menu item: this tutorial from Unity Learn explains how to add custom menus.

Automation tips

AssetPostprocessor: when you bring assets into Unity, there are a number of import settings that you can set up, that can impact the performance of your game. So, it’s important to choose the right settings (and remember them). The AssetPostprocessor API lets you hook into the import pipeline and run scripts prior to or after importing assets.

ISerializationCallbackReceiver: It's a hassle if you have to serialize and deserialize two lists and then worry about, "Do they match up really?" Use a dictionary and the serialization callbacks to handle it seamlessly.

EditorApplication callbacks are important because they change the behavior of Unity and modify the editor to how you want it to work.

OnValidate(): This will get called on a component anytime you change any of its values: it validates that the value ranges are correct and any other custom functionality you might want.

PostProcessBuildAttribute is great when you make a build if you're in a post-process it in XCode or change some files also a good one. We covered the things we can do to improve our time to action.

Tips to reduce computation time

Avoid texture import times by using the Cache Server. Or, delay texture import times by choosing the preference "Compress assets on import" in settings. In most cases, you don't need to see the compressed versions of the assets when you open a new project.

Speed up compilation times by putting code (e.g. 3rd party library code or your own Utility code) in the Plugins folder (it’s an older workaround but still a good one). The code in the plugins folder gets compiled to a different assembly; if you change your game code but not the code in the Plugins folder, then the latter won't be compiled, thereby reducing your recompilation time.

You can also use DLLs, which is helped along now by assembly definition files, with which you can specify which scripts should be in which assembly. Then, the scripts you change will only be compiled with other scripts in that assembly.

Unity DLL and assembly definition files

You can also try out the Incremental Compiler (in experimental mode). Built using Microsoft's Roslyn open source compiler project, the Incremental Compiler is designed to dramatically accelerate iterating on your C# code as well as giving you access to the latest and greatest C# 7.2 features.

Unity Incremental Compiler

You can keep track of your compilation times with a tool called the CompileTimeTracker. The tool enables you to keep track of how the script recompilation time of your project grows over time. It shows your log of current compile times, compares that with those from, for example, the day before, and gives you an option to export it to comma-separated values file.

Finally, you can try a different approach to scripting. This is a library that allows you to write Unity scripts in native code: C, C++, assembly. It's not going to be right for every project, however, teams working on bigger projects might consider trying it if their developers are more comfortable in C++ and managing their own memory.

Where to find new (and interesting) things fast in Unity

Unity Package Manager

The Package Manager is a modular system and API that dynamically loads and updates new Unity-developed features in your projects. You can read more about it in this blog. Packages Documentation is here.

Unity Package Manager

Unity Github Repo

What isn’t in Unity’s Github repo? It’s a treasure trove of experimental and preview features, sample projects and scripts, demos...and everything in between.

More resources

We just gotta know! Did you like this content?

Yes. Keep it coming Meh. Could be better