I have been looking at this script for hours and have gotten nowhere. I have two scripts. One manages the score ad is on the gameManager. The second is on the enemy. I cannot figure out what is wrong.
**Score Script**
#pragma strict
var curPoints : int;
function Start () {
}
function ApplyPoints (curPoints : int) {
Debug.Log(curPoints);
GameObject.Find("Scoregui").guiText.text = ""+ curPoints;
}
**Enemy Script**
#pragma strict
var gameManager : GameObject;
function OnCollisionEnter (collision : Collision)
{
gameManager.GetComponent("Score");
Component("Score").SendMessage("ApplyPoints", 10);
Destroy(gameObject);
}
↧