We are here again with our latest curated Unity Tips and Tricks from Twitter. Every Tuesday we collect five (or more) #unitytips post from Twitter. Feel free to check our previous posts too!
Before we start, click on the link below to follow us on Twitter!
If you're using Unity - make sure you use the Lerp appropriate for your use-case!
— Freya Holmér 🔜 IndieCade Europe (@FreyaHolmer) September 23, 2019
Mahtf.Lerp - values
Mathf.LerpAngle - angles
Color.Lerp - colors
Vector#.Lerp - positions
Vector#.Slerp - directions
Quaternion.Slerp - rotations#unitytips
#unitytips To execute something on an instantiated GameObject before Awake() and OnEnable()
— Binary Impact (@BinaryImpactG) September 17, 2019
Just disable the prefab GameObject via SetActive before instantiating. #gamedev #indiedev pic.twitter.com/n96GaQ72z2
If you want to set value for your healthbar and want to avoid singleton you can use ScriptableObjects #unitytips (view it in fullscreen :P). They are like middleman Player.cs > ScriptableObject > UIController, SoundController, Animations and more. Events are included too 🙂 pic.twitter.com/ro2wDWuCf0
— MaZy (@bilosaurus) September 17, 2019
💡Small Tip #002 - Full hierarchy.
— Dig & Fly (@digandfly) September 17, 2019
It is easy to open full hierarchy in Unity if you need...
...just click with Alt. 😉#Unitytips #unity3d #gamedev #indiedev pic.twitter.com/DHXUqdU5BH
You want the GameObject to pop up in hierachy you have written a message for with Debug.Log, Debug.LogWarning or Debug.LogError?
— Michael Huber (@Hubertsn) September 10, 2019
Use the second parameter like
Debug.LogError("Oh no I have broken the game! Time to hide", gameObject)#UnityTip pic.twitter.com/feJptsdTqG