I am trying to make a sign that brings up a panel when you press Enter while the player is over the sign. The code I have written is:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SignScript : MonoBehaviour
{
public GameObject Panel;
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player")
{
UnityEngine.Debug.Log("Triggered1");
if (Input.GetAxis("Submit") == 1)
{
UnityEngine.Debug.Log("Triggered2");
if (Panel == false)
{
Panel.SetActive(true);
UnityEngine.Debug.Log("Triggered3");
}
}
}
}
}
I added code that prints "Triggered1", "Triggered2", and "Triggered3" to the Debug Log when you reach certain parts of the code. When the player is over the sign and is pressing Enter, it should print "Triggered2". For some reason, it is not doing this. Does anyone know why?