Unity Tips Collection

By 09/11/2018 July 9th, 2019 General

Each Tuesday users post their tips about Unity to share shortcuts to all devs, improve the workflow and make things easier for everyone.
Here’s my Unity Tips collection; I post one tip on Twitter each week and I add it here.
You can follow me on twitter and also join the list below to stay updated about all my posts and never miss anything.


Support me

If you like my content and would like to support me, please consider sharing my website and/or supporting me on Patreon, so I can keep producing free quality content for everyone.


Here’s a quick map of this post:

  1. TextArea
  2. Header, Tooltip and Space
  3. Extention Methods
  4. Platform Custom #defines
  5. Multiply Inspector’s editing speed
  6. Built-in shaders
  7. MinMax Attribute
  8. Animation Curves
  9. Un-dock the Preview window
  10. Hierarchy Organization
  11. Particle System Playback time
  12. EditorOnly tag
  13. Assign a shader to a material upon creation
  14. Insert array element in the Inspector
  15. Show the content of multiple folders
  16. Customize Unity’s C# template
  17. Console Window Log Entries
  18. OnValidate
  19. Set Editor Presets as Default
  20. Change the Editor color when it’s in Play Mode
  21. Drag/select scenes in the build settings
  22. Fold the entire Hierarchy
  23. Rich text in Unity’s console
  24. Asset Store search in project window
  25. DisallowMultipleComponent & RequireComponent
  26. Graphy
  27. Drag multiple items in the inspector
  28. Unity Visual Search
  29. NaughtyAttributes
  30. Foldout
  31. Scene Icons
  32. ContextMenu
  33. Inspector Math Expressions
  34. SerializeField & HideInInspector
  35. FormerlySerializedAs
  36. AddComponentMenu
  37. MenuItem

TextArea

You can use the “TextArea” attribute to edit a string in a flexible text area.


Header, Tooltip and Space

You can use the “Header”, “Tooltip” and “Space” attributes to better organize fields in the Inspector.


Extention Methods

You can use extension methods to add functionalities to already existing classes, types, structs and more!


Platform Custom #defines

You can set your own “Platform Custom #defines” to quickly add or remove features from your game’s build.
Read more here.


Multiply Inspector’s editing speed

You can multiply the Inspector’s editing speed by pressing SHIFT (faster) or ALT (slower).


Built-in shaders

You can download all Unity’s built-in shaders (including all CGinc files) by visiting the archive download page.


MinMax Attribute

You can use the ‘MinMax’ attribute I wrote to better edit “random Vector2s” in the Inspector.

MinMaxAttribute.cs

MinMaxDrawer.cs


Animation Curves

You can use Animation Curves to create cool effects for your objects via code.
Read my tutorial about “Lerp/Easing” here.


Un-dock the Preview window

You can un-dock the Preview window from the inspector and place it anywhere you want. (Right-Click on its top bar)


Hierarchy Organization

You can organize your Hierarchy by adding empty GameObjects as divisors.
I also suggest to set their tag to “EditorOnly”, so they’re not saved in the build.

unity tips febucci organize hierarchy divisors organization unitytips tricks


Particle System Playback time

You can control the Particle’s playback time in the Editor to better edit effects.


EditorOnly tag

You can use the “EditorOnly” tag to exclude a GameObject from the final build.


Assign a shader to a material upon creation

You can create a material after clicking on the desired shader to assign it automatically.

unitytips febucci shader assign automatically to a material upon creation


Insert array element in the Inspector

You can insert an array element in the Inspector by pressing the key shortcut “CTRL/CMD + D” (which stands for: “Duplicate”), without having to adjust the next elements manually.

insert array element unity inspector unitytips #unitytips febucci duplicate shortcut key


Show the content of multiple folders

You can see the content of multiple folders by selecting them in the Project Window.

unity febucci tips unitytips show content inside multiple folders project window


Customize Unity’s C# template¬†

You can customize Unity’s C# template by changing the “81-C#” file found in the path: “%EDITOR_PATH%\Data\Resources\ScriptTemplates”.
Remember to store a copy before modifying it!

You can find more info here.
P.S. when saving a copy of the original file, I recommend moving it into another folder or not naming it starting with “81-C#”.

change csharp c# template default unitytips febucci tutorial unity tips


Console Window Log Entries

You can adjust the number of lines shown for each Log in the Console Window, to read more (or less) text per entry.

febucci console window log entries unitytips post #unitytips unity tips


OnValidate

You can make sure you entered the right value in the Inspector by helping you with the OnValidate function.
Read more here.

unitytips post


Set Editor Presets as Default

You can set Editor Presets as default and then apply them by pressing “Reset”

unity presets default #unitytips reset


Editor color in Play Mode

You can remind yourself that the Editor is in Play Mode by changing its “Playmode tint”.


Drag/select scenes in the build settings

You can drag multiple scenes in the build settings and enable/disable them at the same time (instead of one by one).


Fold the entire Hierarchy

You can fold the entire Hierarchy using the following code.
This way you’ll collapse all the GameObjects in the window with a simple click (mostly useful if you also add a keyboard shortcut).

Read more about the Hierarchy window and Unity Hotkeys.
Sources: Unity forum, Unity answers.

febucci unitytips unity fold entire hierarchy gameobjects


Rich text in the console

You can use rich text in Unity’s console.
Read more about Rich Text.


Asset store search in project window

You can search through the Asset Store directly from your project window.


DisallowMultipleComponent & RequireComponent

You can use the attributes DisallowMultipleComponent and RequireComponent to avoid setup errors in your gameObjects.

Read more about DisallowMultipleComponent and RequireComponent


Graphy

You can monitor the performance of your games directly from your builds using this great tool made by @tayx94.

GitHub repository here.


Drag multiple items in the inspector

You can drag multiple items in an array by locking the Inspector.


Unity Visual Search

You can easily find 3D models for your game using Unity Visual Search and preview them in the Editor.
For example, it comes super handy if you’re building a prototype.

Asset Store page (it’s free).


NaughtyAttributes

You can use 20+ handy attributes made by dbrizov on GitHub, like a ReorderableList, a Slider or a ResizableTextArea.

GitHub repository here.


Foldout

You can group variables in the Inspector using the Foldout attribute, made by dimmpixeye on GitHub.
GitHub repository here.


Scene Icons

You can assign icons for GameObjects and Scripts.
Read more here.


ContextMenu

Call methods from the Inspector by using the ContextMenu attribute.
Read more here.


Inspector Math Expressions

You can enter math expressions in the Inspector.


SerializeField & HideInInspector

Choose which variable to show and serialize by using the attributes SerializeField and HideInInspector.
Read more here: SerializeField and HideInInspector.


FormerlySerializedAs

Useful if you need to rename a variable without losing its serialized value.
Read more here.


AddComponentMenu

Organize your scripts in the “AddComponent” Menu in the Inspector by using the AddComponentMenu attribute.
Read more here.


MenuItem

Call methods from the Main Menu and Inspector Context Menus. Be aware that it only works in the Editor, so you need to cut it if you want to release that code. (Add #if UNITY_EDITOR and you’re good to go).
Read more here.


That’s it for now, remember that I update this post each week, so stay tuned!

Follow me on twitter to never miss my posts, see you next time and have a nice day!

There is more!

Read Bonus and Exclusive content, Get Updated when I release new posts, see Behind The Scenes, learn italian words and recipes (it is a joke.. maybe), all for free from your friendly and not-a-corporation febucci! Also, No Spam! Only a few emails each month (and you can unsubscribe at any time)! Give it a try and join us!

Support this blog

From "sharing my posts around" to "contributions on Patreon", this website exists thanks to the support of these awesome people! Please consider supporting me so I can keep producing tutorials for everyone! Thanks!

Become a Patron!