- Home /
Access other variables please help :(
In my game you must find 5 items, and when you find all of them, somehting happens. I have 2 scripts with names "Notes" and "Counter" "Notes" is a component to an item that the player must find. I'm Stuck, and i have no idea what to do to make it work, Please help :(
Notes:
function OnTriggerEnter (other : Collider) {
var n1: Counter = GetComponent(Counter); n1.DoSomething() = true; if(n1 == true) { score ++; }
}
Counter:
function OnTriggerEnter (other : Collider) {
var n1: Counter = GetComponent(Counter); n1.DoSomething() = true; if(n1 == true) { score ++; }
}
Answer by fafase · Aug 23, 2012 at 04:36 PM
Try this one:
http://answers.unity3d.com/questions/246211/Having-scripts-interact.html
You have the different ways to access depending on the purpose.
Your answer
Follow this Question
Related Questions
Help with variables 2 Answers
Trying to access a variable in a different script on a different game object. 1 Answer
boolean questions get, set, in java. 1 Answer
Can't use script name as variable type? 2 Answers
Making a List for Inventory System, Got an error in finding constructors and variables 1 Answer