when my character is on the trigger collider a canvas shows up on how to do something, and when the player press the in this situation the up arrowkey the character should do somthing. The first statement works, because the ui shows but when i press up arrowkey nothing happens. Thanks in advance
using UnityEngine;
using System.Collections;
public class cementary_move : MonoBehaviour
{
public bool onTrigger;
public GameObject Object_use;
public Canvas Canvas_use;
public Transform player;
private void Awake()
{
Canvas_use.enabled = false;
Canvas_use = Object_use.GetComponentInChildren<Canvas>();
}
void OnTriggerEnter(Collider coll)
{
if (coll.gameObject.tag == "Player")
{
onTrigger = true;
Canvas_use.enabled = true;
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("test");
}
}
}
void OnTriggerExit(Collider coll)
{
if (coll.gameObject.tag == "Player")
{
onTrigger = false;
Canvas_use.enabled = false;
}
}
}