Ok so I am trying to send an array to multiple game objects, but when they get it they get it by reference.
This is the basic code;
public var MyTime : Array = new Array( Vector3(0,0,0));
GNPC[i].SendMessage("Data", MyTime);
function Data(X : Array){
MyTime=X;
}
I am trying to make some kind of ghost which moves exactly as you do, I save X and Y for Horizontal Vertical axes while Z is time. (just if you are trying to figure out why I want to send the message)
You should never use the Array class; it’s slow and untyped. Use built-in arrays or generic Lists. In this case you don’t appear to need an array at all, but if you did, you can use System.Array.Copy for built-in arrays in order to make a copy. Also, use lowercase for variable names; uppercase is for classes and methods.
There’s no reason to use it. It’s slower, has fewer features, and is more difficult to use if you’re using #pragma strict (which you really should be) since you have to cast to the correct type.