Godot Version
v4.3.beta2.official [b75f0485b]
Question
In the game I’m working on I have (among others) two scenes, A and B, that should show something on screen and then switch to each other (start by showing A first, then switch to B a bit later, then switch to A again, then to B etc) and keep switching until the player presses a button.
What triggers the event is a simple Timer scene that looks like this:
extends Timer
@export var next_scene : PackedScene
func start_transition(): # triggered by timer's expiry
SignalTrigger.new_scene.emit(next_scene)
queue_free()
So each scene (A and B) has this Timer scene in it where the “next_scene” exported variable is pointing to the other scene… which causes cyclic dependency and corrupts the project.
I’d really like to keep this simple system of switching scenes because it works so well throughout the whole project except in this one instance.
I tried using path names instead of actual scenes in the Timer component’s “next_scene” and this indeed works but it breaks as soon as I move or rename a scene which is impractical.
What would be a good way of making these two scenes point to each other without causing cyclic dependency (if possible using some system that would allow me to not worry about path names)?