- Home /
Increasing And Decreasing An Array Through A Variable
Hello, Im Trying To Make A Variable That Will Hold How Big An Array Is, I'd Like To Do This So That Way I Can Simply Increase And Decrease The Size Of The Array In the Inspector.
How Should I Go About Doing This?
Writing Each Word With Initial Caps Is Hard To Read And Silly.
Its Really Silly To Demean Others While Being A Hypocrite Yourself.
I'm not sure you know what "hypocrite" means. Or "demean" for that matter. That was a (sarcastic, yes) suggestion to avoid deliberately writing in a way that makes things harder to read, because the simple fact is, the more clearly you write, the more likely it is that people will read and understand your question, thereby increasing the chances of getting a helpful response. Going out of your way to make things more difficult for people who might help you is, by any standard, silly.
I understand your meaning, but sarcastic is not the attitude I would suggest taking in life.
It's sometimes warranted. I would suggest not generalizing an entire life attitude from a single comment.
Answer by equalsequals · Jan 30, 2012 at 08:19 PM
This isn't possible with native arrays. An array ( [ ] ) capacity is declared only once, when creating a new array.
You should be able to explicitly declare how large your array is in the Inspector at any time, though, given the array is of a serializable type.
Ive Seen It Done Using For Loops Before, I Had A Script Where You Could Change An Arrays Size Before Too. I $$anonymous$$now What Im Thinking Of Is Possible But I $$anonymous$$ight Be Explaining What Im talking About Wrong.
You could force it to do this by using a custom inspector for your class - if that's what you want.
Answer by awesomeface · Jan 16, 2014 at 03:55 PM
Have you tried using an array that looks like this
var array : float[];
Your answer
Follow this Question
Related Questions
Add Array of Strings to info.plist 2 Answers
Have a 'Torch' script toggle on and off 1 Answer
Can a script enable components? 2 Answers
A node in a childnode? 1 Answer