public sealed class PlaySessionOne in-editor play session: the loop it steps, and everything that has to be undone.
Remarks
The seam [11](../../../docs/plan/11-editor.md) § "Play mode runs a system graph" left open. An EngineLoop's default registration is behaviours, coroutines and transforms; every other system a game runs — physics, audio, navigation, the render extractions — is added by that game's own OnInitialise against a host service. There is no AddStandardSystems, so the editor cannot reproduce a game's frame by scheduling harder. What it *can* do is let whoever owns a service add the systems that need it, which is what an IPlaySystems contribution is — and then let a project's own [GameSystem] declarations be built out of what those contributions provided, which is what IServiceProvider on this class is for.
⚠ Per session, and that is the whole reason this object exists rather than a service in PluginServices. A PhysicsScene is created when Play is pressed and destroyed when Stop is, because a body that simulates while somebody drags a gizmo is a scene that edits itself — and because the entities its bodies live on must be *inside* the snapshot's restore, so that stopping takes them away with everything else a session made. Publishing that scene into a bag which has no removal would hand every later reader a handle to a disposed native world.
⚠ Owns``1 and OnStop run before the world is restored. PlayModeController.Stop releases the session while its entities are still alive, so a contributor destroying bodies has something to destroy — and so the leak comparison that follows measures what the session leaked rather than what it had not got round to freeing yet.
Fields and properties (3)
public EngineLoop LoopThe graph this session steps.
public World WorldThe world it runs over, which is the one being edited.
public IReadOnlyList<string> RunningWhat the contributors said they added, in the order they said it.
Methods (7)
public PlaySession(EngineLoop loop, World world)Builds a session over a loop.
public void Runs(string name)Says what was added, for the report the session opens with.
public T Owns<T>(T resource) where T : IDisposableHands something to the session to dispose when the session ends.
public void OnStop(Action action)Registers something to run when the session ends.
public void Provide<T>(T service) where T : classOffers a service to the contributors that have not attached yet.
public void ProvideValue<T>(T value) where T : structOffers a value to the contributors that have not attached yet.
public bool TryGet<T>(out T? service) where T : classAsks for a service an earlier contribution provided.
Used by (23)
- AnimationWiringTestsVixen.Editor.App.Tests
- ConsumerVixen.Editor.SceneView.Tests
- DeclaredConsumerVixen.Editor.SceneView.Tests
- DeclaredProviderVixen.Editor.SceneView.Tests
- EditorApplicationVixen.Editor.App
- IPlaySystemsVixen.Editor.SceneView
- LyingProviderVixen.Editor.SceneView.Tests
- NudgeVixen.Editor.SceneView.Tests
- PlayAnimationVixen.Editor.App
- PlayDeclaredSystemsTestsVixen.Editor.SceneView.Tests
- PlayDiagnosticsVixen.Editor.App
- PlayModeControllerVixen.Editor.SceneView
- PlayOverlayTestsVixen.Editor.App.Tests
- PlayPhysicsVixen.Editor.App
- PlaySystemOrderVixen.Editor.SceneView
- PlaySystemsTestsVixen.Editor.SceneView.Tests
- PlayTerrainCollidersVixen.Editor.Terrain.Physics
- ProviderVixen.Editor.SceneView.Tests
- RefusesVixen.Editor.SceneView.Tests
- SpawningProviderVixen.Editor.SceneView.Tests
- SuppliesAQuotaVixen.Editor.SceneView.Tests
- SuppliesAWarehouseVixen.Editor.SceneView.Tests
- TerrainSessionTestsVixen.Editor.App.Tests