Engine Stripping

I can’t get the input system to work in WebGL after performing engine stripping on medium or high

I tried adding the
[assembly: Preserve]

to the top of the auto-generated class, but it still strips it and not sure what else to try :slight_smile:

Just to make sure I follow: the problem is that the C# class that is auto-generated for an .inputactions asset is getting stripped? If so, do you have code actually referencing the generated class? If not, stripping sounds like expected behavior.

I am using the auto-generated, PlayerInputActions class, in my player’s input controller script to move my player using

    public PlayerInputActions InputActions { get; set; }

    private void UpdateAxisWithInput(InputAction.CallbackContext context)
    {
        var value = context.ReadValue<Vector2>();

        //bad code for checking if pressing x movement and y movement key
        if (Math.Abs(value.x) >= 0.1f && Math.Abs(value.y) >= 0.1f)
        {
            value = new Vector2(0, 1);//just setting x to 0 and y to 1
        }//help

        _axis = value != Vector2.zero ? value : Axis;
    }

    public void OnEnable()
    {
        InputActions.Pacman.Move.performed += UpdateAxisWithInput;
        InputActions.Enable();
    }

    public void OnDisable()
    {
        InputActions.Pacman.Move.performed -= UpdateAxisWithInput;
        InputActions.Disable();
    }

Stipping on low, everything works
Stripping above low, everything works but my input

I see. Thank you for the details. Opened a ticket and we’ll have a look. Would expect those references there to keep everything relevant in the build but looks like that isn’t happening.

1 Like

@Rene-Damm
Same here, Unity 2019.2.17f1 + iOS + DualShock4 + stripping=high

Could not create a device for 'DUALSHOCK 4 Wireless Controller (iOS)' (exception: System.ArgumentException: Cannot find input control 'touchpadButton'
Parameter name: path
  at UnityEngine.InputSystem.InputControl.GetChildControl (System.String path) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.InputSystem.InputControl.GetChildControl[TControl] (System.String path) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.InputSystem.DualShock.DualShockGamepad.FinishSetup () [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.InputSystem.InputControl.CallFinishSetupRecursive () [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.InputSystem.InputDevice.Build[TDevice] (System.String layoutName, System.String layoutVariants, UnityEngine.InputSystem.Layouts.InputDeviceDescription deviceDescription) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.InputSystem.InputManager.AddDevice (UnityEngine.InputSystem.Utilities.InternedString layout, System.Int32 deviceId, System.String deviceName, UnityEngine.InputSystem.Layouts.InputDeviceDescription deviceDescription, UnityEngine.InputSystem.InputDevice+DeviceFlags deviceFlags, UnityEngine.InputSystem.Utilities.InternedString variants) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.InputSystem.InputManager.AddDevice (UnityEngine.InputSystem.Layouts.InputDeviceDescription description, System.Boolean throwIfNoLayoutFound, System.String deviceName, System.Int32 deviceId, UnityEngine.InputSystem.InputDevice+DeviceFlags deviceFlags) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.InputSystem.InputManager.OnNativeDeviceDiscovered (System.Int32 deviceId, System.String deviceDescriptor) [0x00000] in <00000000000000000000000000000000>:0
  at System.Action`2[T1,T2].Invoke (T1 arg1, T2 arg2) [0x00000] in <00000000000000000000000000000000>:0 )
UnityEngine.InputSystem.InputManager:OnNativeDeviceDiscovered(Int32, String)
System.Action`2:Invoke(T1, T2)