InputSystem 1.11.0 throw error when destroy canvas

It throws MissingReferenceException: The object of type 'UnityEngine.GameObject' has been destroyed but you are still trying to access it.
from at ./Library/PackageCache/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs:476)

here is the code from InputSystemUIInputModule, line 476:

Is using the null-conditional operator ?. sufficient to prevent this exception when dealing with GameObject ?

Seems like someone did an oopsie there. The ? operator should not be used with UnityEngine.Object types because of the fake null handling.

Hello,

@MaskedMouse has right propagation null propagation operator are not compatible with GameObject(cf UNT0008).
This bug has already been reported ISXB-1081 and the fix will be included in the next release.

Thanks for reporting it.

I modified input script and bug go away: https://www.youtube.com/watch?v=FrOlflu6AIg

This isn’t the best fix, will make OnPointerEnter events invoke repeatedly.

Unity’s fix works better, code is here: FIX: ISXB-1081 Fixed "MissingReferenceException" errors when closing … · Unity-Technologies/InputSystem@008f573 · GitHub

2 Likes

thank you
This fixed it