chairfull / GodotRichTextLabel2

Many more advanced features and animations for the RichTextLabel.
MIT License
86 stars 2 forks source link

export exe will crash #11

Closed aiaimimi0920 closed 1 month ago

aiaimimi0920 commented 1 month ago

Reproduction steps:

  1. Create a project containing plugins randomly

  2. Export the project as exe

  3. Open exe, and it will crash

this is error info:

SCRIPT ERROR: Parse Error: Identifier "EditorInterface" not declared in the current scope.
          at: GDScript::reload (res://addons/richtext2/font_helper.gd:26)
SCRIPT ERROR: Parse Error: Cannot infer the type of "sig" variable because the value doesn't have a set type.
          at: GDScript::reload (res://addons/richtext2/font_helper.gd:26)
SCRIPT ERROR: Compile Error:
          at: GDScript::reload (res://addons/richtext2/richer_text_label.gd:-1)
ERROR: Failed to load script "res://addons/richtext2/richer_text_label.gd" with error "Compilation failed".
   at: load (modules/gdscript/gdscript.cpp:3000)
aiaimimi0920 commented 1 month ago

@chairfull Here is a possible solution:

https://github.com/godotengine/godot/issues/91713

var editor_interface = Engine.get_singleton("EditorInterface")
static func _static_init() -> void:
    if Engine.is_editor_hint():
        var editor_interface = Engine.get_singleton("EditorInterface")
        var sig = editor_interface.get_resource_filesystem().filesystem_changed
        if not sig.is_connected(_filesystem_changed):
            sig.connect(_filesystem_changed)
chairfull commented 1 month ago

Thanks for solution. I tested a Linux build and got the same error, but that fixed it for me.