I want to make the first person controller touch the ammo box and then a GUI appears up, but when I use onColliderEnter, it won’t even work, I have set up the tag and everything but I don’t know why it’s not working…
Here is my code
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
bool Message = false;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnColliderEnter (Collider enemy)
{
Debug.Log("AmmoBox colliding");
if (enemy.collider.tag == "krat")
{
Debug.Log("Collision detected");
}
}
void OnGUI(){
if (Message == true)
{
GUI.Box(new Rect(20,20, 100, 30), "debug");
}
}
}