godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.98k stars 20.18k forks source link

Getting False Positive "..Invalid call. Nonexistent function..." when running an EditorPlugin #94499

Closed Lking03x closed 2 months ago

Lking03x commented 2 months ago

Tested versions

4.2.2 stable

System information

Godot v4.2.2.stable - Windows 10.0.22621 - GLES3 (Compatibility)

Issue description

The add-on instantiate AddonControl (which inherits from Control) and add it to the dock. AddonControl define a _ready and initialize function, the first calls the later, in the source.

When running the AddonControl scene in via (F6) the scene works properly, but running the add-on triggers res://addons/BugIsHere/addon_main.gd:17 - Invalid call. Nonexistent function 'initialize' in base 'Control (AddonControl)'.

The Facts:

See "BUG" comments in the project

Steps to reproduce

Enable the plugin

Minimal reproduction project (MRP)

BugNonExistingMethod.zip

Lking03x commented 2 months ago

Oddly setting the texture directly in the _enter_tree function works (_ready is never called!)

addon_control.get_node("TextureRect").texture = AddonUtils.get_first_image_texture()

(get_first_image_texture use the same code as initialize but return the texture)

huwpascoe commented 2 months ago

The other gdscript files need to start with @tool to run in the editor.

Lking03x commented 2 months ago

Thanks a lot. It also solved the error about "Nonexistent function"