I have two scripts:
this is for the object I want to pick up, I added a collider to the object and set it to be a trigger too.
var CoinSound: AudioClip;
function OnTriggerEnter (info : Collider)
{
if (info.tag == "Player")
{
ScoreSystem.myScore += 1;
AudioSource.PlayClipAtPoint(CoinSound, transform.position);
Destroy(gameObject);
}
}
This is the score system script which I attached to the first person controller.
static var myScore = 0;
public var guiSkin : GUISkin;
function OnGUI()
{
GUI.skin = guiSkin;
GUI.Label(Rect((Screen.width / 2) - 60,10, 200, 30), "Score: " + myScore);
}
Nothing happens, there’s no error, it just doesn’t pick up anything.