diff options
Diffstat (limited to 'core/config/engine.cpp')
-rw-r--r-- | core/config/engine.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/config/engine.cpp b/core/config/engine.cpp index b0037ffb37..26f8cdf840 100644 --- a/core/config/engine.cpp +++ b/core/config/engine.cpp @@ -219,3 +219,14 @@ Engine *Engine::get_singleton() { Engine::Engine() { singleton = this; } + +Engine::Singleton::Singleton(const StringName &p_name, Object *p_ptr) : + name(p_name), + ptr(p_ptr) { +#ifdef DEBUG_ENABLED + Reference *ref = Object::cast_to<Reference>(p_ptr); + if (ref && !ref->is_referenced()) { + WARN_PRINT("You must use Ref<> to ensure the lifetime of a Reference object intended to be used as a singleton."); + } +#endif +} |