Unsubscribe events in OnDisable causes NullReferenceException

My approach is quite simple. GameManager got static references to my sub systems like AudioManager, InterfaceManager, SavegameManager etc (managers are not destroyed between scenes) . Components on scene may subscribe to this managers events, like in this sample with ItemsManager event:

private void OnEnable()
{
	GameManager.Items.OnInventoryItemChanged += OnAmountChange;
}
private void OnDisable()
{
	GameManager.Items.OnInventoryItemChanged -= OnAmountChange;
}

This static properties cached on GameManager Awake (and GM is first in script execution order) and if variable is null - try to find it on scene (to find reference if I’ll need this manager in Editor script, for instance.

This approach causes a bunch of NullReferenceExceptions when I stop the game in the editor. Apparently it happens because some of my managers destroyed before this OnDisable called.

By the way, all my managers is placed on the same Object:
61314-2016-01-05-18-14-46-unity-personal-64bit-002-roadu.png

Maybe there is a way to force this object to be destroyed at the end, when all other objects on scene is destroyed?
Will script execution order affect destroy order?

Okay, I find workaround for this specific issue:

private void OnApplicationQuit()
{
	MonoBehaviour[] scripts = FindObjectsOfType<MonoBehaviour>();
	foreach (MonoBehaviour script in scripts)
		script.enabled = false;
}

When OnDisable called - nothing is destroyed yet.

Sometimes the manager is destroyed before listener.

if(GameManager.Items != null)
{
       GameManager.Items.OnInventoryItemChanged -= OnAmountChange;
}

Adding that protection will solve your problem.