Question by
soradude12 · Oct 12, 2015 at 01:34 PM ·
unity 5levelitem pickupfinish
My level will not reset after collecting items
I'm doing a project that requires me to collect items, and once I collect them, I need to touch another collider that causes me to reset the level. However, my script does not seem to be working. Can someone point out what I may be doing wrong? Or any other tips would be appreciated.
public TotemScript totemCount;
void Awake()
{
totemCount = GameObject.Find ("Totem").GetComponent<TotemScript> ();
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player")
{
gameObject.SetActive(false);
totemCount.totemCount++;
}
if (totemCount.totemCount >= 8)
{
Application.LoadLevel(Application.loadedLevel);
}
}
Comment
looking at my code some more, I noticed I forgot to get the script to see what a totem actually is. I know I do this through the update function, but I'm still confused as to what to call.