Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Keyboard inputs are not working in Unity Build for OS X

Discussion in 'Scripting' started by Who-am-I, Aug 4, 2017.

  1. Who-am-I

    Who-am-I

    Joined:
    Mar 29, 2014
    Posts:
    73
    Hello Guys,

    I am facing a issue. This is my simple code if you have any solution/info please suggest me

    Code (CSharp):
    1.     void Update()
    2.     {
    3.         if (Input.GetKeyDown (KeyCode.Escape))
    4.         {
    5.             loginPanel.SetActive (false);
    6.         }
    7.     }
    Can you please help me, why this code is not working in OS X build?
    When I press Escape key only error beep comes
    But it working on editor after build its not working

    I am using Unity 5.4.0 and OS X 10.9.5

    Thanking you
     
  2. Who-am-I

    Who-am-I

    Joined:
    Mar 29, 2014
    Posts:
    73
    After doing a lots of R&D and stretching my hairs I found this issue occur when you launch app using -popupwindow command line argument in OS X then keyboard will not work.
    According to native API of OS X if we are open a app without title bar then we have to override NSWindow canBecomeKeyWindow bool for enable keyboard.

    So anybody here to help me, How can I override the canBecomeKeyWindow bool in unity app?