Skip to content

Can't get method on CallableCustom "Delegate::Invoke" error when using a lambda function in UndoRedo.AddDoMethod and UndoRedo.AddUndoMethod #90430

Open
@robbertzzz

Description

@robbertzzz

Tested versions

Tested on v4.2.1.stable.mono.official [b09f793]

System information

Windows 11

Issue description

I'm converting a tool written in C# from a plugin to a runtime tool and have an undo function where a variable is being bound to the Callable. In C# this can only be done through a lambda, which is what I'm doing. However, unfortunately UndoRedo's AddDoMethod() and AddUndoMethod() throw the error Can't get method on CallableCustom "Delegate::Invoke" which from a quick look in the engine codebase means the function name isn't accessible (which is isn't, it's a lambda function).

Note that this is not the same issue as #70026 because it only happens when the UndoRedo functions are actually called, but it seems to be similar to #80434 except that that's in GDScript.

Steps to reproduce

Use any lambda function when calling UndoRedo.AddDoMethod or UndoRedo.AddUndoMethod, i.e., UndoRedo.AddUndoMethod(Callable.From(() => GD.Print("Hello World!")))

Minimal reproduction project (MRP)

UndoRedoLambdaBug.zip

Run the project, click the button, check the error log.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions