InputSystem 1.8.0 causes compile error: does not contain a definition for 'Assert'

Opening a 2022.3 project in 2023.3.b3 causes:

Assets\Scripts\InputSystem.cs(1651,19): error CS1061: 'InputSystem.DebugActions' does not contain a definition for 'Assert' and no accessible extension method 'Assert' accepting a first argument of type 'InputSystem.DebugActions' could be found (are you missing a using directive or an assembly reference?)

InputSystem is the name of the generated class by the Unity InputSystem Package in my project.:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
//     version 1.8.0
//     from Assets/Configs/InputSystem/InputSystem.inputactions
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

The compile error in InputSystem.cs in line 1651 is the first Assert:

~@InputSystem()
{
    Debug.Assert(!m_Player.enabled, "This will cause a leak and performance issues, InputSystem.Player.Disable() has not been called.");
    Debug.Assert(!m_UI.enabled, "This will cause a leak and performance issues, InputSystem.UI.Disable() has not been called.");
    Debug.Assert(!m_Debug.enabled, "This will cause a leak and performance issues, InputSystem.Debug.Disable() has not been called.");
}
3 Likes

I just had this issue as well after upgrading. I had an action map named “Debug,” which I renamed to “DebugActions,” and the problem disappeared. It seems that having a map called “Debug” results in a property named " @ " of the generated type DebugActions in the generated InputActions script, leading to a naming conflict. The generated file needs to fully qualify the Assert calls with the UnityEngine namespace.

1 Like

Thanks for reporting this, we made an internal bug.

2 Likes

The issue persists in Unity 6000.0.b16 and Input System 1.8.1.

1 Like

The issue persists in Unity 6000.0.2f1 and Input System 1.8.2.

We have not gotten around to this yet :frowning: But the workaround to rename your things should solve this.

The issue persists in Unity 6000.0.4f1 and Input System 1.8.2.

Is there another reason for this error? I also have it (Unity 6000.0.25, didn’t have it in 2022.3) and none of my map is named Debug.
This happens when I change scene:

    ~@PlayerInputActions()
    {
        UnityEngine.Debug.Assert(!m_Default.enabled, "This will cause a leak and performance issues, PlayerInputActions.Default.Disable() has not been called.");
        UnityEngine.Debug.Assert(!m_Planning.enabled, "This will cause a leak and performance issues, PlayerInputActions.Planning.Disable() has not been called.");
        UnityEngine.Debug.Assert(!m_UI.enabled, "This will cause a leak and performance issues, PlayerInputActions.UI.Disable() has not been called.");
    }
3 Likes

I also saw this message when changing scene and found the issue…
I was accessing the InputSystem before scene load to disable controls and re-enabling after the LoadSceneAsync call. But what i didnt think about at first was the InputSystem was attached to a different “version” of the GameObject after scene change.
Once i realized that, simply getting a new reference to the GameObject after the async scene load call the error went away.

Thanks for the reply.
For me it was that I didn’t notice the input action is a disposable, and I didn’t call Dispose on the member instance when destroying the game object. (A singleton gameobject that holds the inputs for the scene lifetime).

The issue persists in Unity 6000.0.26f1 and Input System 1.11.2. :frowning:

2 Likes

The same issue - 6000.0.26f1, 1.11.2.

1 Like

Readding the Generated C# file Solved this for me. (Click on your InputActions → Readd the C# Class file)

Sadly I tried and it did not work for me

I confirm the bug stays in v. 2022.3.57f1

Are you loading a scene with another PlayerInput and trying to enable it again?
For me, I just prevent it from trying to enable again by doing a quick check to see if it’s already instantiated, and then the error never happened again.

Got “leak and performance issues” error when tried to disable map (PlayerActions) for second time at Start() in my manager script using singletone for InputActionAsset. Issue disappeared when I disabled it at OnDestroy().

Double-click on the error and it will take you to the error line in the code, then simply delete the @input… {}

This worked for me.