Hi, can someone tell me how to link this 2 scripts? I have read the Script Reference, but I don’t understand it. http://unity3d.com/support/documentation/ScriptReference/index.Accessing_Other_Game_Objects.html
I have 2 scripts. In the first I have a variable. If I press on “k” the testVariable in the first script is changed to 5. If testVariable is 5, I need to set anotherVariable in the second script to 1. Can someone explain this to me so I can use this in my other scripts?
First script: testInput.js
var testVariable = 1;
function Update ()
{
if(Input.GetKey("k"))
{
testVariable= 5;
}
}
Second script: testOutput.js
var anotherVariable = 0;
function Update ()
{
if(testVariable= 5)
{
anotherVariable= 1;
}
}