Sorry if this question is silly, I’m still a real novice at Unity (and programming). So, I have a player with the following script written:
public GUIText countText;
public GUIText winText;
private int count;
void OnTriggerEnter(Collider other) {
if(other.gameObject.tag == "PickUp"){
other.gameObject.SetActive(false);
count = count - 1;
SetCountText ();
}
}
void SetCountText() {
countText.text = "Count: " + count.ToString ();
if(count == 0){
winText.text = "YOU WIN!";
}
}
The problem is that the player is instantiated, so I can’t assign the GUIText “countText” or “winText” onto the prefab (I think). Could someone please lecture me on some snippet that might point me in the right direction? Many thanks!