Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Can't find gamepad with MacOS Big Sur + Input System

Discussion in 'Input System' started by amaebi_jp, Aug 20, 2021.

  1. amaebi_jp

    amaebi_jp

    Joined:
    Nov 3, 2016
    Posts:
    1
    HI, I am new to unity input system.
    So I created very simple project with this code.
    ----------------------------------------------------------------

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.InputSystem;
    3.  
    4. public class GamepadExample : MonoBehaviour
    5. {
    6.    void Update()
    7.    {
    8.        if (Gamepad.current == null) return;
    9.  
    10.        if (Gamepad.current.buttonNorth.wasPressedThisFrame)
    11.        {
    12.            Debug.Log("Button North Pressed");
    13.        }
    14.        if (Gamepad.current.buttonSouth.wasReleasedThisFrame)
    15.        {
    16.            Debug.Log("Button South Released");
    17.        }
    18.    }
    19.  
    20.    void OnGUI()
    21.    {
    22.        if (Gamepad.current == null) return;
    23.  
    24.        GUILayout.Label($"leftStick: {Gamepad.current.leftStick.ReadValue()}");
    25.        GUILayout.Label($"buttonNorth: {Gamepad.current.buttonNorth.isPressed}");
    26.        GUILayout.Label($"buttonSouth: {Gamepad.current.buttonSouth.isPressed}");
    27.        GUILayout.Label($"buttonEast: {Gamepad.current.buttonEast.isPressed}");
    28.        GUILayout.Label($"buttonWest: {Gamepad.current.buttonWest.isPressed}");
    29.        GUILayout.Label($"leftShoulder: {Gamepad.current.leftShoulder.ReadValue()}");
    30.        GUILayout.Label($"leftTrigger: {Gamepad.current.leftTrigger.ReadValue()}");
    31.        GUILayout.Label($"rightShoulder: {Gamepad.current.rightShoulder.ReadValue()}");
    32.        GUILayout.Label($"rightTrigger: {Gamepad.current.rightTrigger.ReadValue()}");
    33.    }
    34. }
    ----------------------------------------------------------------
    It worked fine with unity editor on windows machine.
    However, I bring same project to MacOS Big Sur machine, It can't work.
    Even though XBOX Controller is connected to MacbookAir, Always Gamepad.current returns null.

    With the Input Manager, I was able to correctly receive the controller input even on a Mac.

    I tried with Unity2019.4.13f and Unity2020.3.16f1 but neither worked correctly.
    How can I use input system with MacOS?