(cherry picked from commit e1150bd912bd6076b8a94544c0ec32f75344976e)
@@ -236,3 +236,13 @@ Engine::Engine() {
_frame_step = 0;
editor_hint = false;
}
+
+Engine::Singleton::Singleton(const StringName &p_name, Object *p_ptr) :
+ name(p_name),
+ ptr(p_ptr) {
+#ifdef DEBUG_ENABLED
+ if (Object::cast_to<Reference>(p_ptr)) {
+ ERR_PRINT("A class intended to be used as a singleton must *not* inherit from Reference.");
+ }
+#endif
+}
@@ -42,10 +42,7 @@ public:
struct Singleton {
StringName name;
Object *ptr;
- Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL) :
- name(p_name),
- ptr(p_ptr) {
- }
+ Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL);
};
private: