Hello!
I have this script
function OnTriggerEnter (other : Collider) {
if(used == false)
{
// Find the child named “ScoreHolder”.
// On the OtherScript attached to it, set score ++.
transform.Find(“ScoreHolder”).GetComponent(Counter).score ++;
}
}function OnTriggerExit (other : Collider) {
if(used == false)
{
used = true;
}
Destroy(destroyedobj);
}
that every time the “player” walk into a “box”, the other script
var score : int = 0;
function Update () {
if(score == 5)
{
//something happens
score = 0;
}
}
change the score,but the object with the second script must be a child to the first one.
The problem is that I can’t have the second script a child to every “box” that the “player” walks into…
What can I do? Please help…