Hi there, I have a script that is trying to call a couple different variables from a couple different game objects. I am using:
var target : myvariable1;
var target : myvariable2;
to recieve the variable.
It works just fine when I have just the first target. The problem is, Unity wont let me have two targets in on script.
Unity just says “Type ‘MyScript’ already has a definition for target”
How do I call different variables from two places in one script?
I thought that you had to name the variable “target” in order to be able to link it to a game object. Unity confused me, because when I named my variable “target” the text went blue in the script editor, where if I named it “target2” it was black. I figured that meant that I could not link “target2” with a game object. As it turns out that is not the case, you can link any variable name with a game object.