Compilation of useful tips for Unity gathered from around Twitter.
The list below features various tips and tricks for Unity for the different areas, ranging from UI, Editor workflow, all the way to programming and level design.
1. Scene view GUI button
2. .NET 4.x null-conditional operators
Switching to .NET 4.x in the player settings of your Unity projects gives you loads of neat C# 6 features! Here are my three favorites #unitytips
Null-conditional operators are great to avoid loads of extra code just to do sequential null checking
3. DisallowMultipleComponent and RequireComponent
4. Menu item shortcuts
You can add keyboard shortcuts to your menu items in @unity3d.
Add % for Ctrl/Cmd, # for Shift, & for Alt before your hotkey. If you don't want a combination, adding underscore _ before your key will do.
5. Non-alloc collision contacts
WOAAAAAA!!! #Unity3d has no GC allocs for getting collision contacts anymore with a new "GetContacts(contactsBuffer)" method in 2018.3! Been waiting for this for ages. This is the only reason I need to expedite my move to 2018 now :)
6. SerializeField for editing private variables
7. Inspector lock
8. Object mirroring
9. Easy two-sided shader
Do you want two-sided materials but are too afraid to delve too deep into the dark art of shader coding? Just create a new standard surface shader and add the words "Cull off" after the "LOD" line. Works with unlit shaders too!
10. Run static method before or after scene load
There is a way to execute code in your scripts without having to create an empty GameObject with a MonoBehaviour. The "[RuntimeInitializeOnLoadMethod]" command allows you to execute methods before and after the scene loads. Useful to do some initialization and cleanup.