Well, I set the “sm” tagged object and the player object to Ontrigger in the scene, and put ScoreKeep.js(the script below) on the player, the gui won’t register and change when the player passes through the “sm” object. I can’t even get confirmation that OnTrigger enter occurred, but in the the scene, I can see the player passing through the “sm” object.
var score = 0;
var scoreText = "Score: 0";
var mySkin : GUISkin;
function OnTriggerEnter( other : Collider ) {
Debug.Log("OnTriggerEnter() was called");
if (other.tag == "sm") {
Debug.Log("Other object was a score marker");
score += 100;
scoreText = "Score: " + score;
Debug.Log("Score is now " + score);
Destroy(other.gameObject);
}
}
function OnGUI () {
GUI.skin = mySkin;
GUI.Label (Rect (10, 10, 500, 200), scoreText.ToString());
}
Please help, its probably a small thing that I missed.