There are probably so many ways to achieve this.
Have a global script which references those scripts and has an OnApplicationPause method. Then you would call
ScriptA.MethodA();
ScriptB.OtherMethod();
Alternatively you could have a boolean to check whether the OnApplicationPause has run on the other script yet, if not, Invoke to check again in 0.2 seconds?.
I’m not sure if there’s a built-in way to control the callback ordering like that if Script Execution Order doesn’t do it.
But there’s several ways you can create your own order and dependencies. You can put an event on Script B, which Script A will listen for for instance:
public class ScriptA : MonoBehaviour {
public ScriptB scriptB;
private void Awake () {
scriptB = FindObjectOfType<ScriptB>(); // get this reference in some way
scriptB.OnPaused.AddListener(OnDependencyPaused);
}
private void OnDependencyPaused() {
// do stuff
}
}
public class ScriptB : MonoBehaviour {
public UnityEvent OnPaused;
public bool IsPaused { get; private set; }
private void OnApplicationPause(bool pause) {
IsPaused = pause;
if(pause) {
OnPaused.Invoke();
}
}
}