Is there something in a project that can interfere with Input.GetKey and/or GetKeyDown from working?
Neither are currently working for a project I’m working with (I’m admittedly rather new to Unity).
Here’s the code I have in an active object:
// Update is called once per frame
void Update () {
Debug.Log("Im here");
if (Input.GetKeyDown("space")) {
Debug.Log("Im in");
Instantiate(respawnPrefab, spawnPlace.transform.position, spawnPlace.transform.rotation);
}
}
When running, the log shows a steady stream of “Im here” messages, but no matter how much the space bar is pressed, “Im in” is never reported in the log and the prefab I’m trying to Instantiate never appears. (I’ve tried this with both GetKeyDown and GetKey).
Any suggestions?
Thanks in advance.
Have fun.
Thank you! That worked Thanks again!
– nickjush