- Home /
Adding elements to a script
Ok, this is a tricky one, let's see if I can explain it. I have a script that makes a wall of cubes. There's variations in which cube the comp decides to print, based on probability and specification. Whew. Basically, I have a "background" cube that consist of most of the grid. Then, there's a rarity color, which prints the math pattern, then, there's also the specific variation, which is a series of values to manually draw a 3d rectangle of cubes within the whole array, of yet a third color.
Did I lose you yet? Ok, so here's the question. How can I address the script to allow me to make "elements" in the editor, where each element is a specific mod? (a list of values)
Yes, hard to follow. Are you reaching for an answer about how to create arrays of custom classes and dynamically add items to them?
What do you mean by list of values and what do you mean by "elements" in the editor?
It sounds like you want to have an array in your script that you can edit in the Inspector, but I'm not sure.
Answer by psychentist · Dec 21, 2011 at 08:08 PM
Turns out I needed an array of custom classes. Thx for your input guys. Jahroy had the right answer.
Answer by psychentist · Dec 19, 2011 at 06:29 PM
I need the code itself to be flexible to the number of variables. I mean elements like the elements in the input manager. You can create a new "element". Each element is an array describing the input and how to interpret it. but the number of arrays is variable. The problem im having is that the code itself must change to accomodate different numbers of element. I'm trying to avoid
If elements = 1, do this.
If elements = 2, do that
... Ad infinatum...
Is that any clearer?
I need a function that will allow mw to create a variable, who's name is stored in a varable. It needs to be something like
Create an element, containing variables, who's names are (the value of varaible 1), (the value of variable 2,)... And insert The following code into it.
// insert code here. `
Your answer
Follow this Question
Related Questions
is it possible to use completely custom made gui elements for unity's extension? 0 Answers
My List only works on last element when I use it to find a path to open into my Resources folder. 1 Answer
How to add Elements? Multiple ones!????? Help PLease 1 Answer
UI buttons and text are being shown as black area 3 Answers
How to get a list of all the GUI elements in a scene? 1 Answer