Godot Version
Godot 4.3.stable
Question
I’m working on a GUI for an editor plugin , and I have a custom class as a Child of Tree called WorldTreeGUI from which I’m connecting signals to other areas of code. From the base class I’m connecting to item_selected and nothing_selected, and from my extension of it im trying to connect to a signal i’ve named new_context.
@tool
class_name WorldTreeGUI
extends Tree
var new_context : Signal
@tool
class_name SomeOtherClass
extends Node
var TreeGUI : WorldTreeGUI
func setup() -> void:
# assigns TreeGUI to an instance which was created before this method is called
TreeGUI.item_selected.connect(TreeGUI_item_selected)
TreeGUI.nothing_selected.connect(TreeGUI_nothing_selected)
TreeGUI.new_context.connect(TreeGUI_new_context)
when i load the project i get the error:
core/variant/callable.cpp:530 - Parameter "obj" is null.
and if i just comment out the line “TreeGUI.new_context.connect(TreeGUI_new_context)” the error goes away, so im certain thats what this is. I double checked and im not instancing anything out of order. I tried using a getter function where i initialize the signal first:
func get_new_context_signal() -> Signal:
new_context = Signal()
return new_context
TreeGUI.get_new_context_signal().connect(TreeGUI_new_context)
but it still returns the same error. I checked the source code at “core/variant/callable.cpp:530” on github where the error was guiding me
Error Signal::emit(const Variant **p_arguments, int p_argcount) const {
Object *obj = ObjectDB::get_instance(object);
if (!obj) {
return ERR_INVALID_DATA;
}
return obj->emit_signalp(name, p_arguments, p_argcount);
}
which seems to imply that its trying to emit the signal, but i havent emitted it anywhere yet? or maybe its that the signal itself hasnt been constructed properly, but then why wouldnt the getter function work?
its not a huge problem, but any help or explanation as to what might be happening would be appreciated. thank you!