- Home /
Custom Hotkeys with _ and then letter not typing
I am trying to make my own custom hotkeys, everything works fine if I add %, #, or & but if I use _ which makes it so you don't have to hold Ctrl, Alt, or Shift in order to access the hotkey. the hotkey works but it seems to disable the keys ability to type. I have tried having the hotkey return a string, a char, and a keycode but no luck so far. ie with my code below when I have a gameobject selected and my mouse is over the scene window, the game object turns off and on, but if I have it over the hierarchy and am trying to rename something I can no longer type the letter H. Any idea how to fix this?
[MenuItem("FuzzyTools/MayaHotkeys/Hide _h")]
private static void HideSelection()
{
if ((EditorWindow.focusedWindow && EditorWindow.focusedWindow.titleContent.text == "Scene") || (EditorWindow.mouseOverWindow && EditorWindow.mouseOverWindow.titleContent.text == "Scene"))
{
List<GameObject> sels = new List<GameObject>();
sels.AddRange(Selection.gameObjects);
foreach (GameObject go in sels)
{
if (go.activeInHierarchy == true)
{
Undo.RegisterCompleteObjectUndo(go, "HideObject");
go.SetActive(false);
}
else
{
Undo.RegisterCompleteObjectUndo(go, "RevealObject");
go.SetActive(true);
}
}
}
}
Your answer
Follow this Question
Related Questions
Hotkey to play animation 1 Answer
_a / _b /_c ...etc.. is supposed to set a hotkey as "a,b,c" but doesn't? 0 Answers
Problems with Ctrl hotkeys 1 Answer
Shortcuts/hotkeys not working 0 Answers
How do you prevent hotkey conflict when entering text? 0 Answers