migueldeicaza / SwiftGodot

New Godot bindings for Swift
https://migueldeicaza.github.io/SwiftGodotDocs/tutorials/swiftgodot-tutorials/
MIT License
985 stars 55 forks source link

@Callable method is not found when called from the GDScript extending the Swift type. #458

Open elijah-semyonov opened 2 months ago

elijah-semyonov commented 2 months ago

Given a class:

@Godot(.tool)
class SwiftNode: Node3D {
    @Callable()
    public func whatever() {
        GD.print("boom")
    }
}

The GDScript fails to call whatever with Parser error: Function whatever() not found in base self:

extends SwiftNode

func _ready():
    whatever() # super.whatever() doesn't work either

Calling whatever on the SwiftNode accessed by $Path from script attached to the scene itself works fine:

extends Node3D # scene.gd

func _ready():
    $SwiftNode.whatever() # works fine