murikistudio / simple-gui-transitions

Godot plugin to swap GUI menus elegantly.
https://godotengine.org/asset-library/asset/2134
MIT License
133 stars 8 forks source link

Unexpected layout shown after change_scene_to_packed(...) #7

Closed hatmix closed 4 months ago

hatmix commented 4 months ago

I have a UI scene reused across levels including the "main menu". If I start any level with "Run Current Scene (F6)" then no menu appears as expected. But, when starting a level from "main menu" the "main menu" layout reappears with the new scene. To prevent this, I found I had to wait an extra frame, like so:

func start_level() -> void:
    GuiTransitions.hide("MainMenu")
    await GuiTransitions.hide_completed
    # Without await an extra frame, the current menu being hidden is shown in the loaded scene
    await Engine.get_main_loop().process_frame
        get_tree().change_scene_to_packed(...)

Happens in both v0.2.2 and v0.3.0 in my testing.

joelgomes1994 commented 4 months ago

Hello, and thanks for the report! I'll test this case scenario as soon as possible. In the meantime, if you could provide an example project in which this issue uccurs, that would be pretty helpful (not required though). Also, tell me which Godot version you are using, so I can investigate using with the same version. :fist_oncoming:

hatmix commented 4 months ago

Classic case of I should've created the minimal reproduction to begin with... The problem was auto start set to true on the transition.

joelgomes1994 commented 4 months ago

Classic case of I should've created the minimal reproduction to begin with... The problem was auto start set to true on the transition.

That happens :laughing:. Anyways, thanks for using Simple GUI Transitions, feel free to contribute or propose new features. Cheers! :wink: