nathanhoad / godot_dialogue_manager

A powerful nonlinear dialogue system for Godot
MIT License
2.04k stars 161 forks source link

NOTIFICATION_TRANSLATION_CHANGED triggered before start() and _ready() #589

Closed ProFiLeR4100 closed 2 months ago

ProFiLeR4100 commented 2 months ago

Describe the bug Not sure if it is related to beta godot version or something else, but when I try to call DialogueManager.ShowExampleDialogueBalloon then NOTIFICATION_TRANSLATION_CHANGED is being triggered start() and _ready(), which causes two errors:

So basically this is new order of execution: _notification -> _ready -> start.

Affected version

To Reproduce Steps to reproduce the behavior:

public partial class Test : Node2D { [Export] public Resource DialogueResource;

public override void _Ready() {
    DialogueManager.ShowExampleDialogueBalloon(
        DialogueResource,
        "this_is_a_node_title"
    );
}

}

- Run scene

Or you can just download attached project with everything patched and then just run it:
[order-of-execution-issue.zip](https://github.com/user-attachments/files/15752507/order-of-execution-issue.zip)

**Expected behavior**
I even don't know what is the expected order of execution, probably this is defect of Godot 4.3-beta1 and not this repo at all.

**Workaround (patch)**

Index: addons/dialogue_manager/example_balloon/example_balloon.gd IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8

diff --git a/addons/dialogue_manager/example_balloon/example_balloon.gd b/addons/dialogue_manager/example_balloon/example_balloon.gd --- a/addons/dialogue_manager/example_balloon/example_balloon.gd (revision 87fcb7a1109bcfedf7fc4e4afc9ffaf34ac2b0f3) +++ b/addons/dialogue_manager/example_balloon/example_balloon.gd (date 1717934143315) @@ -92,6 +92,14 @@ func _notification(what: int) -> void:

Detect a change of locale and update the current dialogue line to show the new language

if what == NOTIFICATION_TRANSLATION_CHANGED:
ProFiLeR4100 commented 2 months ago

Looks like this problem is related to this Godot issue

nathanhoad commented 2 months ago

A workaround is already in the updated example balloon.