Search Unity

Disable ui when controller connected mobile

Discussion in 'Input System' started by JonathenColon, Jan 15, 2020.

  1. JonathenColon

    JonathenColon

    Joined:
    May 7, 2018
    Posts:
    3
    I have tried a few different ways and it disables the UI but when disconnecting the controller to go back to on-screen stick the app just freezes

    One Way i tried
    Code (CSharp):
    1. else if (playerInput.currentControlScheme == "Touch" )
    2.         {
    3.  
    4.             var DS4Controller = DualShock4GampadiOS.current;
    5.  
    6.             if (DS4Controller != null)
    7.             {
    8.                 mobileUI.SetActive(false);
    9.             }
    10.             else
    11.             {
    12.                 mobileUI.SetActive(true);
    13.             }
    14.       }
    15.            
     
    Last edited: Jan 15, 2020