Unity Editor Tips

One of my favorite things about Unity is it’s editor, the two main reasons I like it are live changes and the extra viewpoint of the scene view during testing. Here are some tricks I use to make Unity3D editor even more useful.

Tinting During Play Mode

Just made changes and tweaks to your game but forgot you were in PlayMode and all is lost. Using a Tinted Play Mode can help you notice. Also see the next tip for save a components values.

Edit -> Preferences -> Color -> Playmode Tinting

Save Components Values

When in playmode and you have the changes made to a component(only works with one) click on the gear and select Copy Component. Then exit play mode, click on the gear and select Paste Component Values.

Snapping To The Grid

To Snap to the grid hold down Ctrl.

Edit -> Snap Settings

Locking the Inspector

On the right side of Inspector tab click the lock to toggle Locking current GameObject Inspector tab. Useful for modifying values without Inspector changing focus.

Viewing Variables

  • Debug view allows you to see all of your variables in the Inspector, even private ones. Right Click on Inspector tab and select debug.

  • Naming Sections of Variables in the Editor
    // Example Section
    [Header("Transform Variables")]
    public float xOffset;
    public float yOffset;
    public float zOffset;
    
  • Add Spacing between groups of Variables in Editor
    public float xOffset;
    public float yOffset;
    public float zOffset;
    [Space]
    public float xSpeed;
    public float ySpeed;
    public float zSpeed;
    
  • Collapse Variable View In Editor
    [HideInInspector]
    public int secretNumber;
    
  • Make a Private Variable Show in Editor
    [SerializeField]
    private int currentHealth;
    

Require Component

Use to remind yourself that you need a certain Component for a Script to work.

Note that RequireComponent only checks for missing dependencies during the moment the component is added to a GameObject. Existing instances of the component whose GameObject lacks the new dependencies will not have those dependencies automatically added.

[RequireComponent(typeof(Rigidbody))]
public class YourScript : MonoBehaviour
{
  // your code
}

Setting Variable Range

Inserting before a variable allows you to set a minimum and maximum range for the variable and will add a slider in the editor.

[Range(min, max)]
public float someVariable;

Align Camera With View

Set the Scene how you would like the camera to be then press Ctrl + Shift + F (CMD + Shift + F on Mac) or GameObject -> Align With View

Maximize View

Hover over window and click while holding shift + space

  • Unity3D Tips - So much good stuff here, don’t forget to check out the Live Training Sessions!

  • Thanks to Mike Gieg(Modular exports, Nav Path Editor Extension and Pools Vs Particles)

    Live Training Sep. 21st, 2015: Unity Tips and Tricks Grab Bag

Helpful Resources

  • Thanks to Asbjørn Thirslund

    TOP 10 UNITY TIPS - 2017

    TOP 10 UNITY TIPS #2

  • Thanks to Jayanam Games

    Top 5 Unity 3D Tips, Tricks and Shortcuts

  • Thanks to Mike From MixPixVisuals

    10 Tips & Tricks in Unity 5!