I’m new to working with editor scripts, so I’m running some small tests to see what’s possible. Right now I’m having trouble getting Inputs to work:
I want this script to print its string when I press A from inside the editor:
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class PrintAInEditor : MonoBehaviour
{
void Update ()
{
if(Input.GetKeyDown(KeyCode.A))
{
print("You have pressed A.");
}
}
}
I have it on my mainCamera in a blank scene, but when I hit A, all I get is the ‘apple alert’ beep as though I’ve hit an invalid key. My first thought was that key inputs are locked from user control in editor scripts, but then again I’ve heard of people writing scripts with their own hotkeys.
what am I doing wrong, or how is this done properly?
Many Thanks!