Hello,
I have objects that move through a trigger, and in doing so raise a counter - which in turn loads a new scene when it hits the right ammount.
However, the problem I am facing is that any object with a collidor on will raise the counter, instead of just these characters.
What I am hoping to have is only colliders with a specific tag (In this instance, box.) to effect the coutner trigger.
As far as I know, it SHOULD work with the following, but for some reason it dosn’t Items with other tags or no tags still effect it.
Anywhere, here is the script:
var score : int = 0;
var customButton : GUIStyle;
function OnTriggerEnter (other: Collider){
if(gameObject.tag == "box")
score += 1;
}
function OnGUI () {
GUI.Label( Rect(10, 10, 2000, 2000), "Escaped: " + (score), customButton);
}
function Update () {
if (score == 4) Application.LoadLevel("level1");
}