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

Processors Execution Order Unclear (Bugged?)

Discussion in 'Input System' started by tday_magicfuel, Nov 12, 2019.

  1. tday_magicfuel

    tday_magicfuel

    Joined:
    Apr 10, 2018
    Posts:
    21
    Using v 1.0.0 of the preview input system package I have an action map set up with some touch controls. The idea being this ultimately moves a camera forward/backward based off the player's Y touch delta. I wanted to normalize these values to scale it elsewhere (would use the scale processor, but I want to put that control elsewhere... and it doesn't seem to work).

    upload_2019-11-12_9-0-3.png
    Above you can see the basic set up. On a mobile device I can see it spit out raw values that escape these normalized ranges (values less than -1 or above 1).

    Similarly if I try this on the keyboard equivalent action I don't get proper output.

    Am I missing a setup step? My code is pretty simple, just for debug purposes really to learn how to get the input set up functional.

    Code (CSharp):
    1.  
    2.         private MainInputActions inputActions;
    3.  
    4.         private void OnEnable()
    5.         {
    6.             this.inputActions = new MainInputActions();
    7.             this.inputActions.CameraActions.Enable();
    8.         }
    9.  
    10.         private void Update()
    11.         {
    12.             var inputValue = this.inputActions.CameraActions.CameraY.ReadValue<float>();
    13.             Debug.Log(inputValue.ToString());
    14.         }
    Also, probably a separate topic altogether--but is there a way to simulate touch input (even if it's just one finger via the mouse) with this system?

    EDIT: I believe I've figured it out.... the normalize process doesn't clamp the values to -1, 1--this would be helpful to point out in the documents. It would also be useful in general if this was simply a remap function where we could map it to ranges other than [-1,1]
     
    Last edited: Nov 12, 2019