Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

An Issue About Axis composite type

Discussion in 'Input System' started by LAndyPommel, Nov 7, 2019.

  1. LAndyPommel

    LAndyPommel

    Joined:
    Nov 7, 2019
    Posts:
    2
    Hi guys!
    I'm not sure if this really is an issue or I was just dumb enough that cannot find the solution.
    I found that
    ReadValue<>()
    only return discrete results.

    Here is my setup.
    upload_2019-11-7_22-28-18.png
    The composite type is 1D Axis and it has its min and max.

    I named a float variable call
    horizontalInput
    and used
    ReadValue<float>()
    to get value.
    inputControler.Core.Movement.performed += ctx => horizontalInput = ctx.ReadValue<float>();


    Then I logged the value of horizontalInput and this is what console showed:
    upload_2019-11-7_22-35-4.png

    You can see there is no other middle float values(like 0.256, 0.488, 0.892 whatever) between min and max.

    So the problem here in brief description:
    How can I use the new InputSystem to achieve what old
    Input.GetAxis(string)
    can do?

    Did I miss some settings or toggles that can achieve this?
    I wonder if anyone met the same issue as me. If this was a noob question and already got a solution, could you share a link with me?

    Thank you very much!
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    This is a shortcoming in AxisComposite that's annoyed me, too. It's on the list to add a toggle for this. Maybe I should just slide this into 1.0. The default really should have been to let the original values through.

    Vector2Composite has a similar problem and the plan is to add a toggle there, too.

    ATM, with what's there as of 1.0.0-preview.2, the only solution is to essentially add a custom version of AxisComposite that does this.
     
  3. LAndyPommel

    LAndyPommel

    Joined:
    Nov 7, 2019
    Posts:
    2
    It's okay. Looks like I gotta spend more time on figuring out how to customize and achieve this.
    Thanks for the answer!