Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Feature Request Wrap generated scripts in define

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

  1. ANFADEV

    ANFADEV

    Joined:
    May 27, 2016
    Posts:
    114
    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