Unity Editor script arrows to display a variable

So what I am trying to achieve is this:

Notice how in GUI skins, there are different areas in case your skin is for buttons, sliders, labels etc…

Notice how there are arrows that reveal other stuff inside. How can i do this in a script i add to an object and when i click an arrow it reveals other variables?


In order to do stuff like this you need to start getting into creating custom classes for your scripts.

SOOOO above (or below) your script that you want these fancy stuffs you need to create your custom class

    //100% need using System
    using System;
    public class customClass{
        public int intVariableOne;
        public int intVariableTwo;
        //You get the idea

Then all you have to do is a customClass variable, like you would an int or a bool.

public customClass yayDropDown;

And now in your inspector you’ll have a drop down-able variable group called “yayDropDown” (or whatever) that has all the variables you made in the customClass.

Then, in order to access those variables you reference the variable you made

yayDropDown.intVariableOne = 12;

Hope this helps :slight_smile:

I know this is a very old question but I’m going to post this for anyone else that has the same question.
You can achieve folder-like structures by using EditorGUILayout.Foldout in your script file.