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
  3. Dismiss Notice

Question Trying to define a custom Composite to the new Unity Input System but failing somewhere

Discussion in 'Input System' started by venay0, Jun 4, 2020.

  1. venay0

    venay0

    Joined:
    Aug 26, 2019
    Posts:
    7
    I'm following the "Touch Samples" sample project that comes with the "input system" package.

    In one of the sample scene, there is a script that defines a custom composite Binding (for example the 2D vector composite).

    I'm practically rewriting the same scripts except changing some inputs to be added to the composite, but it's throwing me these errors, and since I'm relatively new to writing code don't know how to begin solving the issue. The manual and the scripting API are no help either.

    this is the example Script that adds a custom composite.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.InputSystem;
    3. using UnityEngine.InputSystem.Layouts;
    4. using UnityEngine.InputSystem.Utilities;
    5. #if UNITY_EDITOR
    6. using UnityEditor;
    7. #endif
    8.  
    9. namespace InputSamples.Drawing
    10. {
    11.     /// <summary>
    12.     /// Simple object to contain information for drag inputs.
    13.     /// </summary>
    14.     public struct PointerInput
    15.     {
    16.        
    17.  
    18.         public bool Contact;
    19.  
    20.         /// <summary>
    21.         /// ID of input type.
    22.         /// </summary>
    23.         public int InputId;
    24.  
    25.         /// <summary>
    26.         /// Position of draw input.
    27.         /// </summary>
    28.         public Vector2 Position;
    29.  
    30.         /// <summary>
    31.         /// Orientation of draw input pen.
    32.         /// </summary>
    33.         public Vector2? Tilt;
    34.  
    35.         /// <summary>
    36.         /// Pressure of draw input.
    37.         /// </summary>
    38.         public float? Pressure;
    39.  
    40.         /// <summary>
    41.         /// Radius of draw input.
    42.         /// </summary>
    43.         public Vector2? Radius;
    44.  
    45.         /// <summary>
    46.         /// Twist of draw input.
    47.         /// </summary>
    48.         public float? Twist;
    49.     }
    50.  
    51.     // What we do in PointerInputManager is to simply create a separate action for each input we need for PointerInput.
    52.     // This here shows a possible alternative that sources all inputs as a single value using a composite. Has pros
    53.     // and cons. Biggest pro is that all the controls actuate together and deliver one input value.
    54.     //
    55.     // NOTE: In PointerControls, we are binding mouse and pen separately from touch. If we didn't care about multitouch,
    56.     //       we wouldn't have to to that but could rather just bind `<Pointer>/position` etc. However, to source each touch
    57.     //       as its own separate PointerInput source, we need to have multiple PointerInputComposites.
    58.     #if UNITY_EDITOR
    59.     [InitializeOnLoad]
    60.     #endif
    61.     public class PointerInputComposite : InputBindingComposite<PointerInput>
    62.     {
    63.         [InputControl(layout = "Button")]
    64.         public int contact;
    65.  
    66.         [InputControl(layout = "Vector2")]
    67.         public int position;
    68.  
    69.         [InputControl(layout = "Vector2")]
    70.         public int tilt;
    71.  
    72.         [InputControl(layout = "Vector2")]
    73.         public int radius;
    74.  
    75.         [InputControl(layout = "Axis")]
    76.         public int pressure;
    77.  
    78.         [InputControl(layout = "Axis")]
    79.         public int twist;
    80.  
    81.         [InputControl(layout = "Integer")]
    82.         public int inputId;
    83.  
    84.         public override PointerInput ReadValue(ref InputBindingCompositeContext context)
    85.         {
    86.             var contact = context.ReadValueAsButton(this.contact);
    87.             var pointerId = context.ReadValue<int>(inputId);
    88.             var pressure = context.ReadValue<float>(this.pressure);
    89.             var radius = context.ReadValue<Vector2, Vector2MagnitudeComparer>(this.radius);
    90.             var tilt = context.ReadValue<Vector2, Vector2MagnitudeComparer>(this.tilt);
    91.             var position = context.ReadValue<Vector2, Vector2MagnitudeComparer>(this.position);
    92.             var twist = context.ReadValue<float>(this.twist);
    93.            
    94.  
    95.             return new PointerInput
    96.             {
    97.                 Contact = contact,
    98.                 InputId = pointerId,
    99.                 Position = position,
    100.                 Tilt = tilt != default ? tilt : (Vector2?)null,
    101.                 Pressure = pressure > 0 ? pressure : (float?)null,
    102.                 Radius = radius.sqrMagnitude > 0 ? radius : (Vector2?)null,
    103.                 Twist = twist > 0 ? twist : (float?)null,
    104.             };
    105.         }
    106.  
    107.         #if UNITY_EDITOR
    108.         static PointerInputComposite()
    109.         {
    110.             Register();
    111.         }
    112.  
    113.         #endif
    114.  
    115.         [RuntimeInitializeOnLoadMethod]
    116.         private static void Register()
    117.         {
    118.             InputSystem.RegisterBindingComposite<PointerInputComposite>();
    119.         }
    120.     }
    121. }
    122.  
    and this is my code for my custom composite:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.InputSystem;
    5. using UnityEngine.InputSystem.Controls;
    6. using UnityEngine.InputSystem.Utilities;
    7. using UnityEngine.InputSystem.Layouts;
    8. #if UNITY_EDITOR
    9. using UnityEditor;
    10. #endif
    11.  
    12.  
    13. public struct myPointerInput
    14. {
    15.     public bool Press;
    16.     public int PressCount;
    17.     public Vector2 Position;
    18.     public Vector2 Delta;
    19.     public Vector2? Radius;
    20.  
    21.     //touch specific
    22.     public bool? Tap;
    23.     //public UnityEngine.InputSystem.TouchPhase? phase;
    24.     public Vector2? StartPosition;
    25.     public float? StartTime;
    26.  
    27.     //mouse Specific
    28.     public Vector2? Scroll;
    29. }
    30.  
    31.  
    32.  
    33.  
    34. #if UNITY_EDITOR
    35. [InitializeOnLoad]
    36. #endif
    37. public class MyPointerInput : InputBindingComposite<myPointerInput>
    38. {
    39.     [InputControl(layout = "Button")]
    40.     public int press;
    41.     [InputControl(layout = "Integer")]
    42.     public int pressCount;
    43.     [InputControl(layout = "Vector2")]
    44.     public int position;
    45.     [InputControl(layout = "Vector2")]
    46.     public int delta;
    47.     [InputControl(layout = "Vector2")]
    48.     public int radius;
    49.  
    50.     //touch specific
    51.     [InputControl(layout = "Button")]
    52.     public int tap;
    53.     //[InputControl(layout = "TouchPhase")]
    54.     //public UnityEngine.InputSystem.TouchPhase phase;
    55.     [InputControl(layout = "Vector2")]
    56.     public int startPosition;
    57.     [InputControl(layout = "Double")]
    58.     public int startTime;
    59.  
    60.     //mouse Specific
    61.     [InputControl(layout = "Vector2")]
    62.     public int scroll;
    63.  
    64.  
    65.    
    66.     public override myPointerInput ReadValue(ref InputBindingCompositeContext context)
    67.     {
    68.         var press = context.ReadValueAsButton(this.press);
    69.         var pressCount = context.ReadValue<int>(this.pressCount);
    70.         var position = context.ReadValue<Vector2, Vector2MagnitudeComparer>(this.position);
    71.         var delta = context.ReadValue<Vector2, Vector2MagnitudeComparer>(this.delta);
    72.         var radius = context.ReadValue<Vector2, Vector2MagnitudeComparer>(this.radius);
    73.  
    74.         var tap = context.ReadValueAsButton(this.tap);
    75.         //var phase = context.ReadValue<UnityEngine.InputSystem.TouchPhase>(this.phase);
    76.         var startPosition = context.ReadValue<Vector2, Vector2MagnitudeComparer>(this.startPosition);
    77.         var startTime = context.ReadValue<float>(this.startTime);
    78.  
    79.         var scroll = context.ReadValue<Vector2, Vector2MagnitudeComparer>(this.scroll);
    80.  
    81.        
    82.  
    83.         return new myPointerInput
    84.         {
    85.             Press = press,
    86.             PressCount = pressCount,
    87.             Position = position,
    88.             Delta = delta,
    89.             Radius = radius.sqrMagnitude > 0 ? radius : (Vector2?)null,
    90.             //Tap = tap,
    91.             StartPosition = startPosition,
    92.             StartTime = startTime,
    93.             Scroll = scroll
    94.         };
    95.     }
    96.  
    97. #if UNITY_EDITOR
    98.     static MyPointerInput()
    99.     {
    100.         Register();
    101.     }
    102. #endif
    103.  
    104.     [RuntimeInitializeOnLoadMethod]
    105.     private static void Register()
    106.     {
    107.         InputSystem.RegisterBindingComposite<myPointerInput>();
    108.     }
    109.  
    110.  
    111. }
    112.  
    and these are the errors :

    Code (CSharp):
    1. ArgumentException: Don't know how to convert PrimitiveValue to 'Object'
    2. Parameter name: type
    3. UnityEngine.InputSystem.Utilities.PrimitiveValue.ConvertTo (System.TypeCode type) (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Utilities/PrimitiveValue.cs:227)
    4. UnityEngine.InputSystem.Utilities.NamedValue.ConvertTo (System.TypeCode type) (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Utilities/NamedValue.cs:28)
    5. UnityEngine.InputSystem.Editor.Lists.ParameterListView.Initialize (System.Type registeredType, UnityEngine.InputSystem.Utilities.ReadOnlyArray`1[TValue] existingParameters) (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Editor/AssetEditor/ParameterListView.cs:146)
    6. UnityEngine.InputSystem.Editor.InputBindingPropertiesView.InitializeCompositeProperties () (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Editor/AssetEditor/InputBindingPropertiesView.cs:194)
    7. UnityEngine.InputSystem.Editor.InputBindingPropertiesView.DrawGeneralProperties () (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Editor/AssetEditor/InputBindingPropertiesView.cs:69)
    8. UnityEngine.InputSystem.Editor.PropertiesViewBase.DrawGeneralGroup () (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Editor/AssetEditor/PropertiesViewBase.cs:59)
    9. UnityEngine.InputSystem.Editor.PropertiesViewBase.OnGUI () (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Editor/AssetEditor/PropertiesViewBase.cs:39)
    10. UnityEngine.InputSystem.Editor.InputActionEditorWindow.DrawPropertiesColumn (System.Single width) (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs:699)
    11. UnityEngine.InputSystem.Editor.InputActionEditorWindow.OnGUI () (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs:637)
    12. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    13. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    14. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    15. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
    16. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
    17. UnityEditor.HostView.Invoke (System.String methodName) (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
    18. UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
    19. UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
    20. UnityEditor.DockArea.OldOnGUI () (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
    21. UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <3736d7cfd1f845a5922f99478cb469e7>:0)
    22. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)  
    Code (CSharp):
    1. GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced.
    2. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    Code (CSharp):
    1. ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
    2. Aborting
    3. UnityEngine.GUILayoutGroup.GetNext () (at <817eebdd70f8402280b9cb11fff8b976>:0)
    4. UnityEngine.GUILayoutUtility.DoGetRect (System.Single minWidth, System.Single maxWidth, System.Single minHeight, System.Single maxHeight, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <817eebdd70f8402280b9cb11fff8b976>:0)
    5. UnityEngine.GUILayoutUtility.GetRect (System.Single minWidth, System.Single maxWidth, System.Single minHeight, System.Single maxHeight, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <817eebdd70f8402280b9cb11fff8b976>:0)
    6. UnityEditor.EditorGUILayout.GetControlRect (System.Boolean hasLabel, System.Single height, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
    7. UnityEditor.EditorGUILayout.Popup (UnityEngine.GUIContent label, System.Int32 selectedIndex, UnityEngine.GUIContent[] displayedOptions, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
    8. UnityEditor.EditorGUILayout.Popup (UnityEngine.GUIContent label, System.Int32 selectedIndex, UnityEngine.GUIContent[] displayedOptions, UnityEngine.GUILayoutOption[] options) (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
    9. UnityEngine.InputSystem.Editor.InputBindingPropertiesView.DrawGeneralProperties () (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Editor/AssetEditor/InputBindingPropertiesView.cs:72)
    10. UnityEngine.InputSystem.Editor.PropertiesViewBase.DrawGeneralGroup () (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Editor/AssetEditor/PropertiesViewBase.cs:59)
    11. UnityEngine.InputSystem.Editor.PropertiesViewBase.OnGUI () (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Editor/AssetEditor/PropertiesViewBase.cs:39)
    12. UnityEngine.InputSystem.Editor.InputActionEditorWindow.DrawPropertiesColumn (System.Single width) (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs:699)
    13. UnityEngine.InputSystem.Editor.InputActionEditorWindow.OnGUI () (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs:637)
    14. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    15. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    16. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    17. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
    18. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
    19. UnityEditor.HostView.Invoke (System.String methodName) (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
    20. UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
    21. UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
    22. UnityEditor.DockArea.OldOnGUI () (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
    23. UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <3736d7cfd1f845a5922f99478cb469e7>:0)
    24. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <3736d7cfd1f845a5922f99478cb469e7>:0)
    25. UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () (at <3736d7cfd1f845a5922f99478cb469e7>:0)
    26. UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Boolean straightY, System.Single pixelsPerPoint, System.Exception& immediateException) (at <3736d7cfd1f845a5922f99478cb469e7>:0)
    27. Rethrow as ImmediateModeException
    28. UnityEngine.UIElements.UIR.RenderChain.Render (UnityEngine.Rect viewport, UnityEngine.Matrix4x4 projection, UnityEngine.UIElements.PanelClearFlags clearFlags) (at <3736d7cfd1f845a5922f99478cb469e7>:0)
    29. UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect viewport, UnityEngine.Matrix4x4 projection) (at <3736d7cfd1f845a5922f99478cb469e7>:0)
    30. UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <3736d7cfd1f845a5922f99478cb469e7>:0)
    31. UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <3736d7cfd1f845a5922f99478cb469e7>:0)
    32. UnityEngine.UIElements.Panel.UpdateForRepaint () (at <3736d7cfd1f845a5922f99478cb469e7>:0)
    33. UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <3736d7cfd1f845a5922f99478cb469e7>:0)
    34. UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <3736d7cfd1f845a5922f99478cb469e7>:0)
    35. UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <3736d7cfd1f845a5922f99478cb469e7>:0)
    36. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <817eebdd70f8402280b9cb11fff8b976>:0)
     
  2. venay0

    venay0

    Joined:
    Aug 26, 2019
    Posts:
    7
    I still don't know what's wrong with my script, but I wrote an identical one in another project and it worked like a charm.

    I still don't know what I did wrong tho if anyone would compare both scripts and determine what was wrong that would be great.

    Here is the new script:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.InputSystem;
    3. using UnityEngine.InputSystem.Utilities;
    4. using UnityEngine.InputSystem.Layouts;
    5. #if UNITY_EDITOR
    6. using UnityEditor;
    7. #endif
    8.  
    9.  
    10. public struct myCompositData
    11. {
    12.     public bool Press;
    13.     public int PressCount;
    14.     public Vector2 Position;
    15.     public Vector2 Delta;
    16.     public Vector2 Radius;
    17.  
    18.     public bool Tap;
    19.     //public UnityEngine.InputSystem.TouchPhase Phase;
    20.     public Vector2 StartPosition;
    21.     public double StartTime;
    22.  
    23.     public Vector2 Scroll;
    24. }
    25.  
    26.  
    27. #if UNITY_EDITOR
    28. [InitializeOnLoad]
    29. #endif
    30. public class myComposit : InputBindingComposite<myCompositData>
    31. {
    32.    
    33.  
    34. #if UNITY_EDITOR
    35.     static myComposit()
    36.     {
    37.         Initialize();
    38.     }
    39. #endif
    40.  
    41.  
    42.     [RuntimeInitializeOnLoadMethod]
    43.     private static void Initialize()
    44.     {
    45.         InputSystem.RegisterBindingComposite<myComposit>();
    46.     }
    47.  
    48.     [InputControl(layout = "Button")]
    49.     public int press;
    50.     [InputControl(layout = "Integer")]
    51.     public int pressCount;
    52.     [InputControl(layout = "Vector2")]
    53.     public int position;
    54.     [InputControl(layout = "Vector2")]
    55.     public int delta;
    56.     [InputControl(layout = "Vector2")]
    57.     public int radius;
    58.  
    59.     [InputControl(layout = "Button")]
    60.     public int tap;
    61.     //[InputControl(layout = "TouchPhase")]
    62.     //public int phase;
    63.     [InputControl(layout = "Vector2")]
    64.     public int startPosition;
    65.     [InputControl(layout = "Double")]
    66.     public int startTime;
    67.  
    68.     [InputControl(layout = "Vector2")]
    69.     public int scroll;
    70.  
    71.    
    72.  
    73.     public override myCompositData ReadValue(ref InputBindingCompositeContext context)
    74.     {
    75.        
    76.         var press = context.ReadValueAsButton(this.press);
    77.         var pressCount = context.ReadValue<int>(this.pressCount);
    78.         var position = context.ReadValue<Vector2, Vector2MagnitudeComparer>(this.position);
    79.         var delta = context.ReadValue<Vector2, Vector2MagnitudeComparer>(this.delta);
    80.         var radius = context.ReadValue<Vector2, Vector2MagnitudeComparer>(this.radius);
    81.  
    82.         var tap = context.ReadValueAsButton(this.tap);
    83.         //var phase = context.ReadValue<UnityEngine.InputSystem.TouchPhase>(this.phase);
    84.         var startPosition = context.ReadValue<Vector2, Vector2MagnitudeComparer>(this.startPosition);
    85.         var startTime = context.ReadValue<double>(this.startTime);
    86.  
    87.         var scroll = context.ReadValue<Vector2, Vector2MagnitudeComparer>(this.scroll);
    88.  
    89.         return new myCompositData()
    90.         {
    91.             Press = press,
    92.             PressCount = pressCount,
    93.             Position = position,
    94.             Delta = delta,
    95.             Radius = radius,
    96.  
    97.             Tap = tap,
    98.             StartPosition = startPosition,
    99.             StartTime = startTime,
    100.  
    101.             Scroll = scroll
    102.  
    103.         };
    104.     }
    105. }
    106.