How can I create a custom editor in Unity that can add or subtract a set of variables in a script?

Hi everyone,

I am trying to create a custom editor in the Unity inspector that can add another set of variables in the script by pressing a “+” symbol in the inspector as well as remove a set of variables that are selected by clicking the “-” symbol. We need this in order to efficiently design the levels. I attached an example below of what I am looking to do; however, with a different set of variables that are specific to my unique situation.
2515261--174211--Screenshot 2016-02-17 16.14.29.png

Right now, my script has 4 variables exposed to the inspector (startDelay, spawnDelay, rail, and numberOfRails). See what I have set up so far below.
2515261--174216--Screenshot 2016-02-17 16.23.43.png

I need to be able to press the “+” symbol in the inspector to create another set of the variables above (startDelay, spawnDelay, rail, and numberOfRails) instead of the “Waypoints” example. I am thinking that I can store these variables in an object which is created out of a class, but I am stumped on the GUI of the inspector. I am at a loss about where to even start for this tool and how to solve this problem.

It would be much appreciated if someone could help me solve this issue or push me in the right direction.

1 Like

Wow, this is perfect! Thank you so much!