custom signal in c++.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lutein

How can I write a custom signal?
Here is source code.

class Root : public Node2D {
	GODOT_CLASS(Root, Node2D)	

	signal my_signal; //I can't see a signal type in c++ file..

	static void _register_methods();
	void _init();
	void _ready();				

Problem is solved.

I found a method in Object class.


There is no need to declare signal type variable.

So I just put them in the _ready function and connect to target node like this.

 void godot::Player::_ready() {	


connect("my_signal",  get_node("target_node_path"), "target_node_function_name");


lutein | 2019-06-02 09:30