Godot Version
4.2
Question
Hi, how I can call method Engine.has_singleton
in C++, I’m trying to create GDExtension but there is no document for it, just GDExtension C++ example — Godot Engine (stable) documentation in English
4.2
Hi, how I can call method Engine.has_singleton
in C++, I’m trying to create GDExtension but there is no document for it, just GDExtension C++ example — Godot Engine (stable) documentation in English
Hey there,
By using
#include <godot_cpp/classes/engine.hpp>
you are able to call
Engine::has_singleton(...)
gives an error
That’s sad.
If you need help, you may provide some information about the error.
a nonstatic member reference must be relative to a specific object
I’d do it something like this:
#include <godot_cpp/classes/engine.hpp>
private:
Engine *_engine;
Object *_singleton;
.cpp ...................
if (_engine->has_singleton("test")) {
_singleton = _engine->get_singleton("test");
}
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.