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!
#unitytips Tuesday! Lookup is a handy C# LINQ class that lets you split up a collection based on a key. You could achieve a similar thing with a Dictionary of collections, but Lookup is more performant, and plays nicely if a key is missing - you'll just get an empty collection. pic.twitter.com/31xq9NQc67— j4nw / Pawnbarian (@_j4nw) August 27, 2019
#unitytips Add the SelectionBase attribute to your MonoBehaviour to always select the gameobject that has the script attached to. #gamedev #indiedev— Binary Impact Post GamesCom (@BinaryImpactG) August 27, 2019
Note: Prefabs have always their respective root object as SelectionBase! pic.twitter.com/jNzAKnEQny
For single line methods you can use expression body definition to reduce the lines of code:https://t.co/oNYRrgj3vD#unitytips #csharp pic.twitter.com/EFfxXOhn5t— Diego Giacomelli (@ogiacomelli) August 27, 2019
Did you know?— Dmitriy Yukhanov (@dmitriy_focus) August 28, 2019
Since Unity 2018.2, Canvas Renderer has a tiny but super helpful toggle: Cull Transparent Mesh!
It does culls geometry of your transparent UI objects (e.g. Image with 0 alpha).
BTW Canvas Group with 0 alpha also culls out =)#unitytips #unity3d #gamedev pic.twitter.com/9i4k2Sg8CS
Just got this hot tip from a Unity example project about how to organize your hierarchy. 🤯#gamedevelopment #UnityTips pic.twitter.com/GJ8XV4b5ob— actual person (@AlexBelzer) August 28, 2019