I’m trying to get gui boxes to open when my player enters an enemies box collider, however it just won’t work. Here’s my code:
using UnityEngine;
using System.Collections;
public class MathQuestions : MonoBehaviour
{
private bool triggered = false;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.tag == “Player”)
{
triggered = true;
}
}
void OnGUI()
{
if (triggered)
{
GUI.Box(new Rect(10, 10, 100, 90), “Loader Menu”);
}
}
}
Here’s the box collider I want to use to open up the GUI box:
And here are my Player’s settings:
Can someone PLEASE help me out?