ME FIRST GAMES
games for me and you
Unity - Secret Tips
Here are some Unity3d tips that commonly slip through the radar.
📌 Scale your project correctly. It's important to have gravity and physics respond realistically when you have rigid bodies colliding or falling with gravity.
📌 Scale your 3d assets correctly. Chaos emerges if every 3d model imported needs to be scaled to a custom size in Unity. Ideally, assets should be scaled to 1, but with exceptions of course.
📌 Avoid Reflection. GetComponent, SendMessage, and Invoke are handy but not performant. Cache the result of GetComponent and avoid the latter.
📌 Lock your Inspector. Some actions require to keep an inspector window open while selecting other game objects, this can be accomplished by tapping the padlock in the upper right corner.
📌 Expose variables in your scripts using SerializedField instead of making everything public.
📌 Reverse an animation by setting the speed to -1 in the AnimationController state.
📌 Write your Gizmos inside your custom scripts. This may display the field of view and range for an AI-controlled enemy.
📌 SerializeField List<> will show in the inspector. I still recommend arrays for the default case, but if your container is going to change size over time, try using a List<>.
📌 Create your own class to manage time. Whether it's pausing, resuming, or slow motion, having a single class that controls Time.timeScale changes will make everything easier.
📌 Master the difference between Awake() and Start(). Awake() is invoked before Instantiate() returns and Start() will be called later during the frame after Awake() is called on everything else.
⭐️ Follow @mefirstgames for more #gamedev tips.
Leave a Reply.
Me First Games is an independent game studio dedicated to creating unique and bizarre video games.
Star Impact is an upcoming adventure platformer coming to PC, Mac, and Linux.
Copyright (c) 2020 Me First LLC