Skip to content

Commit

Permalink
Better backToRoot implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Deseteral committed Oct 7, 2023
1 parent 6537091 commit 0542a59
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/scene-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export abstract class SceneManager {
* Removes all scenes except the oldest one, which will be the next active scene.
*/
public static backToRoot(): void {
SceneManager.clearStack(SceneManager.sceneStack.at(-1)!);
while (SceneManager.sceneStack.length > 1) {
SceneManager.popScene();
}
}

public static _update(): void {
Expand Down

0 comments on commit 0542a59

Please sign in to comment.