ME FIRST GAMES
Menu

games for me and you

Unity - Inspector Tips

9/27/2020

0 Comments

 
Picture
Unity is extremely flexible and things can be accomplished in multiple ways. One downside is that your inspector can become very messy if your prefabs and scripts don't adhere to a standard.

Here are some tips:


🚀 Always place your script at the top of the inspector and on the root of your Prefab. Digging through game objects and discovering multiple scripts controlling a single prefab is not fun. It's also fun scrolling down the inspector looking for something important.

🚀 Use the attribute Header to mark the beginning of a section. I don't recommend grouping your variables into a class or struct unless your code architecture demands it. Header does not require any extra heap allocations and allows quick moving of variables. Do not create data structures just for editor appearance.

🚀 Clearly define what serialized variables should be touched by designers vs developers. If you have non-programmers on your team that will tweak prefabs, come up with a clear naming standard so they know they can tweak the settings without breaking the prefab. e.g. Anything with the name "Settings" can be touched by designers.

🚀 Use attribute Tooltip on all variables that will be touched by designers. Comments in code will be hidden from designers and placing a Header on each variable will eat up much space in the small Inspector window. In the perfect scenario, a designer knows that with any setting they can tweak, they can also hover the mouse to learn more details.

🚀 Use OnValidate to sanitize values and verify your serialized variables are correct. It's much better to get logged errors before runtime, and this will help prevent wasted time and confusion.

➡️ Follow @mefirstgames
​#gamedev #indiegamedev #indiegame #games #gamer #coder #coding #programmerlife #unity3d #webdev #codinglife #programmer #coding #fun #softwareengineer #software #coder #programmer #unity #indiegamedev #webdev #gamer #stem #learn #learn2code

0 Comments



Leave a Reply.

    Picture
    Me First Games is an independent game studio dedicated to creating unique and bizarre video games.
    GAMES HERE

    Red Matter

    Star Impact is an upcoming adventure platformer coming to PC, Mac, and Linux.

    Archives

    April 2021
    February 2021
    December 2020
    November 2020
    October 2020
    September 2020
    August 2020
    July 2020
    June 2020
    May 2020
    April 2019
    March 2019
    December 2018
    April 2018

    Categories

    All

    RSS Feed

Copyright (c) 2020 Me First LLC
  • STU the First AI
  • Blog
  • Contact
  • Unity Tools
    • Hierarchy Comments
  • STU the First AI
  • Blog
  • Contact
  • Unity Tools
    • Hierarchy Comments