How to connect in c++ signal to method not using GD script

Godot Version



Using c++ , i like to be able connect Timer timeout signal to my class method
Can’t find any documentation on how to do that .
In the Doc
At the the signal example uses GD script , i like to be able to call c++ function instated .

i did try like this :

void HealthManager::_ready() 

		pTimer = get_node<godot::Timer>("Timer");
		//pTimer->connect("timeout", godot::Callable(this,"test"));
		pTimer->connect("timeout", callable_mp(this, &HealthManager::test));

	void HealthManager::test()

And the :test() never called


1 Like

You need to add your callback method to the ClassDB in order for it to work.

1 Like