/// <summary>Does the action now if the scene is loaded or when it finishes loading.</summary> /// <param name="mb">The MonoBehaviour to run this from.</param> /// <param name="action">The action to take.</param> public static Coroutine ActionNowOrWhenSceneLoaded(this MonoBehaviour mb, Action action) { if (action == null) { return(null); } if (SceneManagement.SceneManager.GetActiveScene().isLoaded) { action(); } else { return(mb.ActionWhenPredicate(action, () => SceneManagement.SceneManager.GetActiveScene().isLoaded)); } return(null); }