Developing Game in Unity? Check Template Projects, Tools, VFX & many more!
HomeBlogUnity

Compilation of Useful Unity Twitter Tips

476
Below is a compilation of useful tips for Unity 3D gathered from around the Twitter:

1. Do you want to display GUI elements in the Scene View to make development steps faster and easier? Add a static method of your choice to the onSceneGUIDelegate and draw everything you want.
@rehawk

onSceneGUIDelegate

2. Switching to .NET 4.x in the player settings of your Unity projects give 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
@FreyaHolmer

C# 6 features

3. You can use the attributes DisallowMultipleComponent and RequireComponent to avoid setup errors in your gameObjects.
@febucci

Sharp Coder Video Player

4. You can add keyboard shortcuts to your menu items in @unity3d.
Add % for Ctrl/Cmd, # for Shift, & for Alt before your hot key. If you don't want a combination, adding underscore _ before your key will do.
@sgt3v

Sharp Coder Video Player

5. WOAAAAAA!!! #Unity3d has no GC allocs for getting collision contacts anymore with a new GetContacts(contactsBuffer) method in 2018.3! Been waiting this for ages. This is like the only reason I need to expedite my move to 2018 now :)
@Nothke

6. Don't use the "public" access modifier just to edit a field from the Inspector. Use [SerializeField] attribute instead.
@tntcproject

SerializeField

7. Did you know that you can drag multiple items in an array by locking the Inspector?
@febucci

Sharp Coder Video Player

8. Hey Lvl Designers! Wanna have a mirror object like this statue... Just change the scale to -1
@MrTeels

9. 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!
@HarryAlisavakis

Sharp Coder Video Player

10. 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.
@arturonereu