Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[How To] Add custom space between variables

Discussion in 'Scripting' started by eTag96, Sep 5, 2011.

  1. eTag96

    eTag96

    Joined:
    Oct 24, 2010
    Posts:
    110
    say I have several variables in one (C#) script, ie:

    Code (csharp):
    1. public Color guiColor;
    2.     /*
    3.      * r    =   255
    4.      * g    =   200
    5.      * b    =   0
    6.      * a    =   175
    7.      *
    8.      * */
    9.     public Font f;
    10.     public int fSize;
    11.    
    12.     public List<string> english = new List<string>();
    13.     public List<string> spanish = new List<string>();
    14.     public List<string> german = new List<string>();
    15.     public List<string> dutch = new List<string>();
    How would I make a visible space between the code in the Inspector? Is this possible without making a custom inspector? Or is it easy to make a duplicate inspector with this one additional feature? Please help me with this. :) Thank you for reading.
     
  2. eTag96

    eTag96

    Joined:
    Oct 24, 2010
    Posts:
    110
    Setting up an empty enum and setting up several useless variables work, ie:

    Code (csharp):
    1. public enum Space {_, __}
    2.     public Color guiColor;
    3.     public Font f;
    4.     public int fSize;
    5.    
    6.     public Space _;
    7.    
    8.     public string cur_lv="Level ";
    9.     public string nxt_lv="Level ";
    10.    
    11.     public Space __;
    12.    
    13.     public List<string> text = new List<string>();
    14.     public List<string> english = new List<string>();
    15.     public List<string> spanish = new List<string>();
    16.     public List<string> german = new List<string>();
    17.     public List<string> french = new List<string>();
    18.     public List<string> dutch = new List<string>();
    19.    
    20.     public Space ___;
    But I'm sure there must be a less... newbie way to do such a thing, isn't there?
     
  3. Eiznek

    Eiznek

    Joined:
    Jun 9, 2011
    Posts:
    374
    Custom editor would be the only way id go about it.. they are fairly easy to write up. If you need with understanding it ill write one for you later based on your code. Im currently out and about town on my phone.
     
  4. DarkWarriorZ

    DarkWarriorZ

    Joined:
    Jan 15, 2020
    Posts:
    1
    do this, it's extremely simple:
    1. public int yourInt = 0;
    2. [Space] //This is how to space between variables
    3. public int yourIntTwo = 0;
     
unityunity