Search Unity

Resolved Custom Composite not working anymore with 1.1.1

Discussion in 'Input System' started by cp-, Sep 10, 2021.

  1. cp-

    cp-

    Joined:
    Mar 29, 2018
    Posts:
    78
    @Rene-Damm

    I have a custom mouse drag composite that worked perfectly fine before (tested with 1.0.2 and multiple 1.1.0 preview versions up until 1.1.0-pre.6).

    Code (CSharp):
    1. public class MouseDragVector3Composite : InputBindingComposite<Vector3>
    2.     {
    3.         public override Vector3 ReadValue(ref InputBindingCompositeContext context)
    4.         {
    5.             var b = context.ReadValueAsButton(Button);
    6.             var x = context.ReadValue<float>(X);
    7.             var y = context.ReadValue<float>(Y);
    8.             var z = context.ReadValue<float>(Z);
    9.             var v = new Vector3(x, y, z);
    10.  
    11.             return b ? v : default;
    12.         }
    13.  
    14.         public override float EvaluateMagnitude(ref InputBindingCompositeContext context)
    15.         {
    16.             return ReadValue(ref context).magnitude;
    17.         }
    18.  
    19.         [InputControl(layout = "Button")]
    20.         [UsedImplicitly]
    21.         public int Button;
    22.  
    23.         [InputControl(layout = "Axis")]
    24.         [UsedImplicitly]
    25.         public int X;
    26.  
    27.         [InputControl(layout = "Axis")]
    28.         [UsedImplicitly]
    29.         public int Y;
    30.  
    31.         [InputControl(layout = "Axis")]
    32.         [UsedImplicitly]
    33.         public int Z;
    34.     }
    35.  
    upload_2021-9-10_9-50-17.png

    The action map is used via PlayerInput firing C# events.

    On <1.1.1 the events fired whenever one of the composite values changed. Now on 1.1.1 the delta values stay at their previous value when they should fall to 0 (no mouse movement). Only when I release the button the delta values go back to their actual values of 0.
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Hi @cp-, could you file a ticket and post the number?
     
  3. cp-

    cp-

    Joined:
    Mar 29, 2018
    Posts:
    78
    I guess it only happened after updating the InputSystem from 1.0.2 to 1.1.1 without restarting the editor.

    Indeed, I was prepared to restart because when updating to 1.1.0-pre.x there were always lots of errors being spammed to the console. But there were no errors when updating to 1.1.1 so I did not restart.

    So could you please reenable the error spamming?! ;p
     
  4. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Heh, part of the reason why there's a 1.1.1 and no 1.1.0 is we specifically fixed an upgrade error :D

    Glad to hear it's working fine after a restart.