title: Is it possible to change the scene to load before the editor entered play mode in Unity?
body: <p>I put all the managers in the game on an empty scene called Init. The editor must be run from this scene for the game to work properly. So I want to write an editor script that loads the Init scene first and then loads the level scene.</p>
  <p>My editor script:</p>
  <pre><code>[InitializeOnLoad]
  public class LevelFix
  {   
      static LevelFix()
      {
          EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
      }
      private static void OnPlayModeStateChanged(PlayModeStateChange state)
      {  
          switch (state)
          {
              case PlayModeStateChange.ExitingEditMode:
                  bool initCheck = true;
                  int sceneCount = SceneManager.sceneCount;
                  Scene lastLevel = SceneManager.GetActiveScene();                
  
                  for (int i = 0; i &lt; sceneCount; i++) 
                  {
                      Scene scene = SceneManager.GetSceneAt(i);
                      if (scene.name.Contains(&quot;Level&quot;))
                      {                        
                          initCheck = false;
                      }                    
                  }
                    
                  if (!initCheck)
                  {                    
                      PlayerPrefs.SetString(&quot;LastLevel&quot;, lastLevel.name);
                  }
                  
                  break;
  
              case PlayModeStateChange.EnteredPlayMode:                
                  SceneManager.LoadScene(0); //Init Scene
                  break;
          } 
      }    
  } 
  </code></pre>
  <p>Init Manager responsible for the level to be loaded (Located in Init scene):</p>
  <pre><code> public class InitManager : MonoBehaviour
  {
      private IEnumerator Start()
      {
          yield return SceneManager.LoadSceneAsync(PlayerPrefs.GetString(&quot;LastLevel&quot;, &quot;Level01&quot;), LoadSceneMode.Additive);
          SceneManager.SetActiveScene(SceneManager.GetSceneByName(PlayerPrefs.GetString(&quot;LastLevel&quot;, &quot;Level01&quot;)));             
          Destroy(gameObject);
      }
  }
  </code></pre>
  <p>The problem with the code above is that whichever level I run, first that level opens and then Init opens. This situation causes some errors. Is there any way to set the scene to be loaded before the editor entered play mode?</p>