- Home /
Set number of public objects through the inspector
Hello, is there any way that I can set the number of public objects through the inspector?
Lets say that I have a variable called public int NumberOfObjects;
When I set that to 1 in the inspector the inspector show me 1 public object.
And when I change NumberOfObjects to 2, it will show me 2 objects instead etc.
Is there anyway this can be done?
Comment
Answer by Bunny83 · May 31, 2012 at 11:59 AM
The amount of public members is given by your class and can't be changed at runtime. However an array does exactly what you need.
I guess C#?
public GameObject[] objects;
Just try it and see what happens ;)