I wrote a code that display a button prompt when a player enters a certain area. When the player presses that button, the scene should change.
using UnityEngine;
using System.Collections;
public class SwitchScenes : MonoBehaviour {
public GameObject prompt;
void OnTriggerEnter ()
{
prompt.SetActive(true);
if (Input.GetKeyDown("Q"))
{
Application.LoadLevel ("4Room");
}
}
void OnTriggerExit(Collider other) {
prompt.SetActive(false);
}
}
But Unity says that the input key is unknown, no matter what key I put there.
I’ve just started coding, so help would be very appreciated!