Hi there,
I’m trying to make a quick-object placer script that allows me to use keyboard buttons 1-2-3…0 to instantiate items on cursor position. The script is NOT to be used in playmode, but to be used in editor to help build levels faster.
I can do it via GUILayout.Button, but I’m unable to use key bindings via my script in editor.
The script resembles something like this;
#if UNITY_EDITOR
[CustomEditor(typeof(QuickBuildTool))]
class BuildEditor : Editor
{
public override void OnInspectorGUI()
{
if (GUILayout.Button("Instantiate Asset"))
{
GameObject newObj = PrefabUtility.InstantiatePrefab(targ.kitchenItems[0]) as GameObject;
//I want to press "1" to insantiate kitchenItems[0] instead of doing it by inspector buttons.
}
}
Can you please advise me on how to proceed?