AudioStream Globals issues when using change_scene_to_file #2

Closed
opened 2026-05-26 23:43:16 +02:00 by fbouju · 2 comments
Owner

Scene managment system

Every minigame scene is loaded one after another with the loadNextScene() function.
This function is implemented independently in each minigame main script.

Eg:

func loadNextScene():
	var currentScene = get_tree().root.get_child(3).get_child(1)
	var nextScene = load("res://scenes/shopping.tscn").instantiate()
	get_tree().root.get_child(3).add_child(nextScene)
	get_tree().root.get_child(3).remove_child(currentScene)
	currentScene.queue_free()

The plan is to create a global scene handler.

2 possible ways i see :

  • Create a loadScene(scenePath) function
  • Create a queue of scenes and a function loadNextScene() that gets the top of the queue and loads it

The scene handler could use a signal so that minigames can notify when to load the next scene.

Files impacted :

  • cutMirror.gd
  • meltSand.gd
  • painting_canvas.gd
  • runeGame.gd
  • smashGlass.gd
  • start_scene.gd
  • shopping.gd

Originally posted by @fbouju in http://git.home/abgit/MirrorMirror/issues/1#issue-1

### Scene managment system Every minigame scene is loaded one after another with the `loadNextScene()` function. This function is implemented independently in each minigame main script. Eg: ``` func loadNextScene(): var currentScene = get_tree().root.get_child(3).get_child(1) var nextScene = load("res://scenes/shopping.tscn").instantiate() get_tree().root.get_child(3).add_child(nextScene) get_tree().root.get_child(3).remove_child(currentScene) currentScene.queue_free() ``` The plan is to create a global scene handler. 2 possible ways i see : - Create a `loadScene(scenePath)` function - Create a queue of scenes and a function `loadNextScene()` that gets the top of the queue and loads it The scene handler could use a signal so that minigames can notify when to load the next scene. Files impacted : - `cutMirror.gd` - `meltSand.gd` - `painting_canvas.gd` - `runeGame.gd` - `smashGlass.gd` - `start_scene.gd` - `shopping.gd` _Originally posted by @fbouju in http://git.home/abgit/MirrorMirror/issues/1#issue-1_
fbouju added reference refactor 2026-05-26 23:43:54 +02:00
fbouju self-assigned this 2026-05-26 23:45:36 +02:00
Author
Owner

A crash appears when using the builtin function change_scene_to_file()

Invalid assignment of property or key 'stream' with value of type 'AudioStreamMP3' on a base object of type 'previously freed'.

The root cause seems to be an audio stream that is not freed properly in shopping.gd:64

image

A crash appears when using the builtin function `change_scene_to_file()` Invalid assignment of property or key 'stream' with value of type 'AudioStreamMP3' on a base object of type 'previously freed'. The root cause seems to be an audio stream that is not freed properly in shopping.gd:64 ![image](/attachments/6bbf4d5b-914f-435a-9265-0b2c7c3a36a6)
113 KiB
Owner

The audio players were children of PauseMenu node, contained by the gameInterface node that was a child of the startScene, once the startScene got freed when switching scenes, the audio players too, hence the error, this is fixed in 91badf90cc

More details in my answer to #1

I think we can close this issue but I'm not sure so I'll let you do it once you read this

The audio players were children of PauseMenu node, contained by the gameInterface node that was a child of the startScene, once the startScene got freed when switching scenes, the audio players too, hence the error, this is fixed in 91badf90cc More details in [my answer](http://git.home/abgit/MirrorMirror/issues/1#issuecomment-18) to #1 I think we can close this issue but I'm not sure so I'll let you do it once you read this
fbouju added this to the Refactoring project 2026-05-27 10:51:02 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
abgit/MirrorMirror#2
No description provided.