Topic was automatically imported from the old Question2Answer platform.
Asked By
supagu
Old Version
Published before Godot 3 was released.
I am writing a c++ plugin and have a singleton setup. What I would like is some method in my plugin to be called to once the engine is setup and running such that all its features a ready to use. I want to connect to a website using https so cannot do this in the register_types callback.
Is there anyway to be notified in C++ of certain events that occur in the engine?
I don’t know of the proper way of doing singletons in Godot C++, but one way would be to make your class a Node (so you can make multiple of them, if possible?) that you can then put in AutoLoad. Then you’ll be able to use the NOTIFICATION_READY notification (same as _ready in script)
If you want to bind a class to gdscript with a singleton set up, you have to bind a dummy class. The dummy class access the singeton. The process of setting up a signal should be similar to a regular function call.