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?

Mr. 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 determine 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.

1 Answer

1

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.