Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signal method gets called within the editor and returns "not found" error #13070

Closed
mthreis opened this issue Nov 20, 2017 · 12 comments · Fixed by #22297
Closed

Signal method gets called within the editor and returns "not found" error #13070

mthreis opened this issue Nov 20, 2017 · 12 comments · Fixed by #22297

Comments

@mthreis
Copy link

mthreis commented Nov 20, 2017

By adding a signal method to a C# script (such as Control's _resized()), Godot calls it on the editor and returns the error:

core\object.cpp:1127 - Error calling method from signal 'resized': Control(Window.cs)::OnWindowResized': Method not found.

Script:

public class Window : Control
{
    void OnWindowResized()
    {
        var size = OS.GetWindowSize();
        OS.SetWindowSize(new Vector2(Mathf.floor(size.x / 2) * 2, Mathf.floor(size.y / 2) * 2));
    }
}

rrh

@akien-mga
Copy link
Member

CC @neikeq

@akien-mga
Copy link
Member

Can this still be reproduced in the current master branch?

@akien-mga akien-mga changed the title [Mono/Bug] Signal method gets called within the editor and returns "not found" error [Mono] Signal method gets called within the editor and returns "not found" error Jan 6, 2018
@paulloz
Copy link
Member

paulloz commented Jan 19, 2018

Yes, but this is not specific to C#. The same error occur with connections GDScript.

@vnen vnen removed the topic:dotnet label Jan 19, 2018
@akien-mga akien-mga changed the title [Mono] Signal method gets called within the editor and returns "not found" error Signal method gets called within the editor and returns "not found" error Jan 24, 2018
@akien-mga akien-mga modified the milestones: 3.0, 3.1 Jan 24, 2018
@aschuhardt
Copy link

Is there a known workaround for using signals with Mono?

@akien-mga
Copy link
Member

Here's a minimal reproduction project from #19826: Example Project.zip

@Skaruts
Copy link

Skaruts commented Sep 3, 2018

I have this issue but it's not related to C#, but to the tree_entered signal (and it's on a different line in the source code). I give a node that signal and connect it, and then when I switch scenes (when I switch back to this one) the editor throws that error in the output:

core/object.cpp:1261 - Error calling method from signal 'tree_entered': 'Control::_on_Control_tree_entered': Method not found.

Seems to happen with any kind of node, and both if the signal is connected to the node or the parent. (I also tried it in a blank project, and it behaved the same way.)

I tested this just now using a 3.1 nightly build from Hugo Lucurcio's site that I just downloaded.

I haven't tested other signals.

@neikeq neikeq removed their assignment Sep 6, 2018
@neikeq
Copy link
Contributor

neikeq commented Sep 6, 2018

@reduz Not a mono issue.

@Piet-G
Copy link
Contributor

Piet-G commented Sep 13, 2018

This would have to be solved in a way that it still allows for tool scripts to connect to those signals in the editor.

@akien-mga
Copy link
Member

This would have to be solved in a way that it still allows for tool scripts to connect to those signals in the editor.

This is not specific to tool scripts, but to any node with a signal attached that can be called by the editor, when the editor itself uses this node (e.g. AnimationPlayer's animation_finished). See #13070 (comment)

@Piet-G
Copy link
Contributor

Piet-G commented Sep 20, 2018

@akien-mga Yeah I know. I just mentioned that because the first instinct might be just not to connect those signals while in the editor, but then tool scripts who might want to receive signals while in the editor would not receive them. That's why I mentioned them there.

If a signal like animation_finished was connected to a function in a tool script it wouldn't even produce an error since it would just call the function like normal.

@Poobslag
Copy link

I'm still encountering this error in Godot v3.2.2. If a setter/getter emits a signal, and is invoked in a tool script which connects to non-tool scripts, the console will log 'Method not found' errors.

tool
extends LineEdit

# Setting this 'melodic' value in the editor causes console errors.
export (String) var melodic: String setget set_melodic

signal melodic_changed

func set_melodic(new_melodic: String) -> void:
	emit_signal("melodic_changed")

Here's a simple reproduction project: signal-errors.zip

Editing the LineEdit's 'melodic' property in the editor throws errors as it tries to send a signal to a non-tool node. I'd expect the signals to just be tossed into the void.

@akien-mga
Copy link
Member

Please open a new issue, this was fixed two years ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants