Call queue_free() on scenes during removal
This commit is contained in:
parent
5ab659c9f7
commit
52c6d029d9
1 changed files with 15 additions and 5 deletions
20
src/sms.gd
20
src/sms.gd
|
@ -77,11 +77,21 @@ func remove_scene(sname: String, force_remove: bool = false) -> bool:
|
|||
if force_remove: await logger.crashf("Sms", "force_remove = true is not allowed", true)
|
||||
logger.verbf("Sms", "Removing scene \"" + sname + "\"")
|
||||
match(exists(sname)):
|
||||
CoreTypes.SceneType.DEBUG: scenes_debug.remove_child(scenes[sname]["class"])
|
||||
CoreTypes.SceneType.CUTSCENE: scenes_cutscene.remove_child(scenes[sname]["class"])
|
||||
CoreTypes.SceneType.MENU: scenes_menu.remove_child(scenes[sname]["class"])
|
||||
CoreTypes.SceneType.MAIN: scenes_main.remove_child(scenes[sname]["class"])
|
||||
CoreTypes.SceneType.BACKGROUND: scenes_background.remove_child(scenes[sname]["class"])
|
||||
CoreTypes.SceneType.DEBUG:
|
||||
scenes_debug.remove_child(scenes[sname]["class"])
|
||||
scenes[sname]["class"].queue_free()
|
||||
CoreTypes.SceneType.CUTSCENE:
|
||||
scenes_cutscene.remove_child(scenes[sname]["class"])
|
||||
scenes[sname]["class"].queue_free()
|
||||
CoreTypes.SceneType.MENU:
|
||||
scenes_menu.remove_child(scenes[sname]["class"])
|
||||
scenes[sname]["class"].queue_free()
|
||||
CoreTypes.SceneType.MAIN:
|
||||
scenes_main.remove_child(scenes[sname]["class"])
|
||||
scenes[sname]["class"].queue_free()
|
||||
CoreTypes.SceneType.BACKGROUND:
|
||||
scenes_background.remove_child(scenes[sname]["class"])
|
||||
scenes[sname]["class"].queue_free()
|
||||
CoreTypes.SceneType.NONE:
|
||||
logger.errorf("Sms", "Scene \"" + sname + "\" does not exist")
|
||||
return false
|
||||
|
|
Loading…
Reference in a new issue