One line in OnDestroy fixes it.

The problem
Set, but never cleared.
public static GameManager Instance { get; private set; } protected override void OnStart(){ Instance = this;}
When this component is destroyed, Instance still points at it.
Why it happens
Static outlives the scene.
A static belongs to the class, not the object. Destroying the component doesn't clear it.
- Scene changes
- component destroyed
- Instance
- still set
- Other code
- uses a dead component
The fix
Clean up on the way out.
OnDestroy runs when a component is removed. Undo there whatever OnStart set up.
OnStartsets it
OnDestroyclears it
The fix in code
Clear it, if it's still you.
protected override void OnDestroy(){ if ( Instance == this ) Instance = null;}
Check it's still you first. A newer instance may already have taken over.
The rule
Whatever OnStart sets, OnDestroy cleans.
- Statics
- set to null
- Spawned objects
- Destroy() them
- Check first
- Instance == this