hi I’ve unregistered my callbacks but the inputsystem keeps trying to call them in the next scene and errors out with
MissingReferenceException: The object of type ‘Platformer2DPlayerController’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Object.get_name () (at <42a5878ce129403083acccf18e43363f>:0)
SFApps.Platformer2DPlayerController.PowerUp () (at Assets/Scripts/Platformer2DPlayerController.cs:287)
SFApps.Platformer2DPlayerController.SetPowerUpInput (UnityEngine.InputSystem.InputAction+CallbackContext context) (at Assets/Scripts/Platformer2DPlayerController.cs:247)
UnityEngine.InputSystem.Utilities.DelegateHelpers.InvokeCallbacksSafe[TValue] (UnityEngine.InputSystem.Utilities.InlinedArray1[System.Action
1[TValue]]& callbacks, TValue argument, System.String callbackName, System.Object context) (at Library/PackageCache/com.unity.inputsystem@1.0.2/InputSystem/Utilities/DelegateHelpers.cs:51)
UnityEngine.InputSystem.LowLevel.<>c__DisplayClass7_0:<set_onUpdate>b__0(NativeInputUpdateType, NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate(NativeInputUpdateType, IntPtr)
i’ve unregistered the callbacks with
public class Platformer2DPlayerController : APlayerController
private void OnDisable()
{
…
inputActionPowerUp.started -= SetJumpInput;
inputActionPowerUp.performed -= SetJumpInput;
inputActionPowerUp.canceled -= SetJumpInput;
what am I missing? alternatively is there a way to unregister all callbacks in the next scene?
Thanks