- Home /
Using scripts inside an Array
Hi every one, I get stuck with this:
How can I get/set a variable value that's in a script's Array (List, Builtin Array, etc.).
The main idea is to use an editor script(lets call this main script) that put a script(data holder) in other script(game object with it) in a Builtin Array, List, etc. and then get/set any public variable using the main script.
//Main Script
for (n = 0; n < nScriptCount; n ++)
target.scriptList.Add(dataHolder);
target.scriptList[n].someValue = "Set value";
//Game Object Script
public var scriptList = new List.<MonoScript>();
//Data Holder
public var someValue : String;
Any help will be appreciated.
So broadly speaking this should work (sans the . between List and <<). What about your solution doesn't work?
$$anonymous$$r. Bovine, before you let a comment, try to check if the text it's for C# or JS, the code above it's for JS.
I did try to deter$$anonymous$$e the script - it's only the last line thats obvious - and I use obvious in the broadest sense possible here. Perhaps rather you could state the script's language. At any rate I was trying to help you - hence my post in the first place.
Answer by 3D-Magic-VR · Aug 10, 2011 at 10:48 PM
Hi every one, I got the answer for this little code, the main reason to this not to work it's because the scripts in the list are a ghosts scripts, they are not active so there's no way I could get/set the values in the script element.
I will try another way to do this kind of stuff.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Help with static variables not being saved 1 Answer
Joystick DPad axis to bool 1 Answer
boolean questions get, set, in java. 1 Answer
Why does my variable show a rising score AND 0 at the same time? 2 Answers