- Home /
Adding UI elements to the 'script' part in the editor?
Hello,
In unity, exposed variable are visible in the editor. Some elements (for example the particle emitter) have controls, in this area, to add new elements (I suppose this is some kind of array programmatically?). How would I do this myself?
If you happen to have a page where all info about this functionality is shown, please share :)
Thanks in advance!
Simon.
Answer by G_Sacristan · May 29, 2011 at 12:43 PM
well it is an array:
//define an GameObject array to add for example box collider
var objects: GameObject[];
for(var i=0;i<objects.length;i++) objects[i].AddComponent("BoxCollider");
its that simple
Well here u will get to add to array as many elements as u want and to each object there will be a BoxCollider attached, no matter how much elements have u added.
Cheers.
Your answer
Follow this Question
Related Questions
How do I get the default scene GUI for a CustomEditor for RectTransform? 1 Answer
Track when the value is changed and get it 0 Answers
Initialising List array for use in a custom Editor 1 Answer
How to properly handle Undo events in custom inspector? 0 Answers
How can i create a pup-up menu like the one for choose the shader on materials in unity 2019? 1 Answer