Skip to content

Commit 1101309

Browse files
committed
Clean up editor tools when entering play mode, notably camera preview doesn't stick around in play mode anymore
1 parent 976f371 commit 1101309

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

game/addons/tools/Code/Scene/SceneView/SceneViewportWidget.Game.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public void OnViewModeChanged( SceneViewWidget.ViewMode viewMode )
4040
public void SetGameView()
4141
{
4242
GameMode.SetPlayWidget( Renderer );
43+
Tools.ClearScreen();
4344
IsGameView = true;
4445
}
4546

@@ -82,6 +83,7 @@ public void OnEject()
8283
public void OnPossessGame()
8384
{
8485
GameMode.SetPlayWidget( Renderer );
86+
Tools.ClearScreen();
8587
IsGameView = true;
8688
}
8789
}

game/addons/tools/Code/Scene/Tools/EditorToolManager.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,14 @@ private void CreateToolFor( Type t )
188188
}
189189
}
190190

191+
public void ClearScreen()
192+
{
193+
foreach ( var tool in ComponentTools )
194+
tool?.Dispose();
195+
ComponentTools.Clear();
196+
previousHash = -1;
197+
}
198+
191199
/// <summary>
192200
/// Switches to the named tool type next editor frame.
193201
/// </summary>

0 commit comments

Comments
 (0)