Howto:Array of a specific class that shows vars in inspector

Hi,

I’m going crazy -.-

I’ve got two classes:

public class BotWave : MonoBehaviour
{
    public float Duration = 30.0f;
    public int NumberOfBots = 1;
}

public class WaveDefines : MonoBehaviour
{   
    public BotWave[] Waves;
}

When attaching the “WaveDefines” script to an empty gameobject the inspector shows some slots for empty BotWave objects.

What I’d like to have is the following:
The inspector should show x times the BotWave variables. I’d like to modify them in the inspector. I don’t want to add gameobjects that have the BotWave scripts attached. I tried several things but nothing worked as desired :frowning: is it possible at all?

your code is right

You will have a Waves field on the behavior. You can then unfold it and find a 0, enter the amount of slots you want and tada you have the desired amount of slots.
You then just have to drag in instances of BotWave to have them in there (and through doubleclicking them you are taken to them to edit them)

Hi,

I don’t want to drag them in. I want them to be there without dragging. Is this possible?

If the BotWave script isn’t intended to be attached to a game object, it doesn’t need to inherit from MonoBehaviour. Remove that and you should get (close to) what you want.