Hey,
I have a script in which I try to access the length of an array in another .js script. Frustratingly, an error keeps coming up, saying: 'myArray' is not a member of 'UnityEngine.Component'.
I've been trying to solve this for several hours and I'm at my wit's end...
The code looks something like this (ScriptA.js and ScriptB.js are components of the same object, 'Code'):
ScriptA.js
function Update () {
if (GetComponent("ScriptB").myArray.length > 0) {
//Execute some stuff
}
}
ScriptB.js
var myArray = new Array();
function OnGUI () {
if (someButton) {
myArray.Push(new myClass);
}
}
myClass.js
class myClass {
var intA : int;
var intB : int;
}