Files
sbox-public/engine/Sandbox.Tools/Scene/Session/GameEditorSession.cs
Sol Williams 80aa601771 Restore separate GameEditorSessions (#3453)
* SceneEditorSession: make game vs editor scenes more distinct, Scene is whichever is currently active

* Route prefab update, model reload etc events to both scenes if needed

* SceneTree update checking a bit cleaner

* Bring back GameEditorSessions instead, so undo, selection etc can all be linked 1:1 with scenes again

* tweak and tidy
2025-11-26 16:05:23 +00:00

28 lines
583 B
C#

namespace Editor;
public class GameEditorSession : SceneEditorSession
{
internal static GameEditorSession Current = null;
public SceneEditorSession Parent { get; init; }
public override bool IsPlaying => true;
public GameEditorSession( SceneEditorSession parent, Scene scene ) : base( scene )
{
Parent = parent;
Assert.IsNull( Current, "Attempted to create new GameEditorSession when one already exists!" );
Current = this;
}
public override void Destroy()
{
base.Destroy();
Current = null;
}
public override void StopPlaying() => Parent.StopPlaying();
}