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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Input Manager Controller Axis Problems

Discussion in 'Scripting' started by bendelany693, May 20, 2020.

  1. bendelany693

    bendelany693

    Joined:
    May 10, 2020
    Posts:
    3
    Hi everyone, I'm trying to set up my XBox One Controller's Right Trigger axis on Mac with Unity 2019.3, but I can't get the input to register on any of the axes. When I print out the axis info to the console, it says "Unknown Xbox Controller" instead of any axis info. Has anyone encountered this, or does anyone have any ideas to get the trigger working? Thanks for the help!
     

    Attached Files:

  2. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    989
    i assume u are using old input system, remember the trigger is continuous and not discrete. you can show us your code and tell us if you install mac drivers
     
  3. bendelany693

    bendelany693

    Joined:
    May 10, 2020
    Posts:
    3
    Here is the code with the IF statement I'm trying to enter if the Right trigger is pressed:

    Code (CSharp):
    1. private void FixedUpdate()
    2.     {
    3.         float rightx = Input.GetAxis("LookDirectionHorizontal");
    4.         float righty = Input.GetAxis("LookDirectionVertical");
    5.         direction = new Vector2(rightx, righty).normalized;
    6.         angle = Mathf.Atan2(righty, rightx) * Mathf.Rad2Deg - 90f;
    7.         firepoint.transform.eulerAngles = Vector3.forward * angle;
    8.  
    9.         if ((Input.GetAxis("LookDirectionHorizontal") != 0) && Time.time > nextFire)
    10.         {
    11.             //Debug.Log(Input.GetAxis("LookDirectionHorizontal"));
    12.  
    13.             nextFire = Time.time + fireRate;
    14.             GameObject bullet = Instantiate(bullet1, firepoint.transform.position, firepoint.transform.rotation);
    15.  
    16.         }
    I set up the input manger to "snap" the axis to 1 if the trigger is pressed, but once again I haven't been able to read any inout from the trigger. I have not downloaded any additional drivers that don't come pre-installed on a mac.
     
  4. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,806
    Your mapping is wrong. LT is axis 9, RT is axis 10, left stick is axis 8, right stick is axis 9, dpad horizontal is axis 6, and dpad vertical is axis 7.

    edit: disregard, these are the windows mappings. I missed the MacOS part.
     
  5. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    989
    Not to worry friend, is easy mistake for sure.

    First i would make sure u have download drivers. This not so important for window but for apple i feel is necessary.

    after that u can use something called controller test

    https://assetstore.unity.com/packages/tools/input-management/controller-tester-43621

    remember trigger is not like on/off so this is where some people are making mistake.