Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

How To Use Input Manager On Ios?

Discussion in 'Getting Started' started by Snoozey, Apr 13, 2019.

  1. Snoozey

    Snoozey

    Joined:
    Mar 1, 2014
    Posts:
    1
    Hello,

    I've been stuck for days on trying to get this to work. I have it working for when it is PC, but on Mobile it does not work.

    My thought process is on PC pressing escape calls the input manager via the "Cancel" option. It works just fine. How would I make a button on the screen call that Cancel option when pressed via mobile?

    Code (CSharp):
    1.     public void MenuButton()
    2.     {
    3.         if (CrossPlatformInputManager.GetButtonDown("Cancel"))
    4.         {
    5.             menu.SetActive(!menu.activeSelf);
    6.         }
    7.     }
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    8,283
    You would put a Canvas in your scene, add a Button to it, and have that button's OnClick event invoke some code that toggles the menu.

    Go through the UI tutorials (see Learn at the top of this page) if this sounds unfamiliar.
     
    Ryiah likes this.