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

Feature Request Wrap generated scripts in define

Discussion in 'Input System' started by imblue4d, Jan 14, 2023.

  1. imblue4d

    imblue4d

    Joined:
    May 27, 2016
    Posts:
    110
    Hi,

    While developing an in-game system that supports both input systems, it occurred to me that any user will have to manually delete the generated input scripts, when not using the new input system

    I've recurred to wrapping the generated scripts in the new input system's define like this:

    Code (CSharp):
    1. //------------------------------------------------------------------------------
    2. // <auto-generated>
    3. //     This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
    4. //     version 1.4.4
    5. //
    6. //     Changes to this file may cause incorrect behavior and will be lost if
    7. //     the code is regenerated.
    8. // </auto-generated>
    9. //------------------------------------------------------------------------------
    10. #if ENABLE_INPUT_SYSTEM // <------
    11. using System;
    12. using System.Collections;
    13. using System.Collections.Generic;
    14. using UnityEngine.InputSystem;
    15. using UnityEngine.InputSystem.Utilities;
    16.  
    17. namespace MyNamespace {
    18.     public partial class @MyInputActions : IInputActionCollection2, IDisposable {
    19.         //...
    20.     }
    21. }
    22. #endif // <------
    But as you can guess it's very tedious to do this each time, before delivering/publishing

    So i'm asking please to add a toggle option on the input action asset in order to wrap the generated scripts in the define (or even better do this automatically in all cases).

    This will contribute to the overall qualty and user experience with the new input system