Search Issue Tracker

Postponed means that the issue was either a feature request or something that requires major refactoring on our side. Since that makes the issue not actionable in the close future we choose to close it as Postponed and add it on our internal roadmaps and technical debt pages instead.

Postponed

Votes

4

Found in

5.3.3p2

Issue ID

779917

Regression

No

Custom MenuItem hotkey takes priority over Input Field

Input

-

Steps to reproduce:
1. Create new empty project
2. Create folder named "Editor"
3. In said folder create C# script named "MenuItems"
4. Paste this code to the script:
using UnityEngine;
using UnityEditor;

public static class MenuItems {

[MenuItem("Bug/Log to console _a")]
static void Bug()
{
Debug.Log("Hello World!");
}
}
5. Press "a" in editor and notice console output
6. Create Canvas->Input Field game object in scene
7. Play the scene and try to input letter "a" into the input field

Actual result: "Hello World" is output to console and nothing is written in Input Field
Expected result: Custom hotkeys get paused during play mode or there is an optional parameter to specify this behaviour

Tested and reproduced:
Windows 10
Unity 5.1.4f1, 5.2.4p1, 5.3.3p3, 5.4.0b10

Comments (9)

  1. xeosD

    Apr 15, 2023 06:31

    This "problem" exists as recently as 2021.3.x.

    But in fact it's easy to work around by adding a validator clause before/after the menu time to only enable it in the desired context, ie something like this:

    static bool SceneWinOnly()
    { return EditorWindow.focusedWindow is UnityEditor.SceneView;}

    [MenuItem("Scene/Scene/Fly Camera Down _PGDN", true)]
    static bool EnableFlyDown() { return SceneWinOnly();}

  2. couetcouet88

    Sep 27, 2018 07:18

    Same problem in 2018.2.7

  3. Aeroxima

    Aug 14, 2018 23:48

    Still a problem in 2018 =/

    Would really like to be able to make and use hotkeys, and also still type words without letters being eaten.

  4. FeastSC2

    Apr 14, 2017 03:27

    I have the same issue in 5.6 please fix this!

  5. mcarriere

    Oct 21, 2016 01:02

    This also occurs on 5.5.0b7 on Windows (but not OSX)

  6. Team-Beachbum

    Oct 10, 2016 21:53

    This problem seems unique to Windows Unity. I don't have this problem on OSX. I haven't tested on Linux, however.

  7. SarfaraazAlladin

    Jul 05, 2016 21:54

    Same issue in 5.3.4f1 Would love to see this resolved, as I have some custom tools that would be great to access from a single key press.

  8. hexagonius

    Apr 23, 2016 07:57

    The problem even exists when you try to type text into UI Text fields. The letters just gets swallowed by the MenuItem and the function executed. The hotkeys really should be ignored when any text field is focused or forced to at least one modifier key. Not that one can avoid it on its own.

  9. babaqalex

    Mar 24, 2016 21:52

    have the same problem in 5.3.3f1

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.