Class SceneBootstrapper
Editor utility that automatically opens the bootstrap scene when entering Play mode from any scene, then restores the previously open scene when Play mode exits.
[InitializeOnLoad]
public class SceneBootstrapper
Inheritance
Remarks
The bootstrap scene registers core services (IEventAggregator,
DatabaseConnector, …) via [RuntimeInitializeOnLoadMethod]
before any game object's Awake runs. If a developer presses Play while editing a
non-bootstrap scene, those registrations still happen (because they use
RuntimeInitializeOnLoadMethod), but any MonoBehaviours in the bootstrap scene that
register additional services would be absent. This class prevents that gap by opening the
bootstrap scene first.
Adapted from the Unity multiplayer samples: https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop