Script with variable number of variables ?


I'd like to create a script which take GameObject in parameters in the inspector. But I'd like to add a GameObject variable by pressing a button in the inspector.

Can it be done ?

Regards, Sladix.

Just add an array of GameObjects as a member of your script, e.g.

public GameObject[] myGameObjects;

The default array inspector will let you add them, but to have a special button, you'd want to make a custom inspector.