activate button on triggerenter
Hi, I have a problem and I feel like a major idiot. I am building a game where your character has to navigate an obstacle course. on the main menu there are 20 level buttons and 4 bonus level buttons every time you complete a level (lets say level 4) you unlock the next level (level 5). and on level ten I put a key, on that key I have a trigger and I am trying to figure out how enable one bonus level when you run into a certain key. Here is the code attached to the key
using UnityEngine; public class KeyUnlock : MonoBehaviour { public bool keypickedup = false; public GameObject goldkey; public void OnTriggerEnter() { keypickedup = true; goldkey.SetActive(false); } }
But I can't however hard I try get another script (on the main menu) to recognize that the keypickedup bool is = true. Please help!!! I have been trying to fix it for days