10 tips and tricks - Volume 1
Updated: Oct 25, 2019
Today, I want to share you the first volume of 10 Unity software tips and tricks. They will help you in your development process.
1. Default physics material
When working with 3D or 2D Physics in Unity, it's easy to forget that you can override the
2. Playmode Tint
If you repeatedly find yourself editing values only to realize you were in PlayMode when doing so (and thus losing all your edits), raise your hand… actually, don’t raise it. Instead, use Edit > Preferences > Colors > Playmode Tint to have Unity automatically colour-tint the editor interface so you’re visually reminded that you’re in PlayMode. Damn handy.
3. More canvases
Each Canvas acts as a renderable collection of UI elements in a scene. You'll likely benefit by using more than one in your scene as a single UI change forces the entire Canvasmesh to be regenerated. Keep this in mind when designing your Canvaslayouts.
4. UI control flow
The Navigation setting on an interactive UI element is used to determine “tab order” which changes the focus of UI elements in controller, keyboard, etc based user interaction models. The Visualizebutton shows the focus flow in the Scene view.
5. Event triggers
You can use the EventTrigger component on a Selectable UI element (Button, Slider, etc) to expose additional event types in the Inspector. This is useful if you want to make a UI or scene change dynamically based on user input other than OnClick
6. Masked scrolling
For masked scrolling, simply add a ScrollRect component to a parent Panel containing a Mask component. Then set the Content property of the ScrollRect to the child panel whose bounds exceed those of the parent panel. Scrolly time.
7. Usage of coroutines instead of update
Set up a looping coroutine in the Start() method of a component instead of using the Update() method if updates for a Component don’t need the game/app frame rate (.2f coroutine will run 5 times a second vs 60fps)
8. Object look at in scene view
When in the Scene view, have you ever wanted to make one GameObject point or “look at” another GameObject? To pull this off, simply hover the GameObject in focus with your Rotate Tool selected and then hold ctrl/cmd + shift as you drag the Rotate Gizmo. While dragging, the GameObject you’re rotating will “look at” the GameObject you hover. Things are looking up.
9. Movement precision
To improve precision while moving a GameObject in a scene, you can hold down ctrl/cmd while dragging its Translate Gizmo. This enables the position of the GameObject you’re moving to snap in incremental units. Go to Edit > Snap Settings to customize.
10. Maximize windows in Editor
Shortcuts are your friend. Use shift + spacebar after focusing your cursor in a specific window to toggle fullscreen. This is very useful when focused on the Scene view and toggling PlayMode.