diff --git a/Source/Engine/Level/Actor.h b/Source/Engine/Level/Actor.h
index 872f4798b..5ba661a9e 100644
--- a/Source/Engine/Level/Actor.h
+++ b/Source/Engine/Level/Actor.h
@@ -222,6 +222,22 @@ public:
return (T*)GetChild(T::GetStaticClass());
}
+ ///
+ /// Finds the child actor of the given type or creates a new one.
+ ///
+ /// The child actor.
+ template
+ T* GetOrAddChild()
+ {
+ T* result = (T*)GetChild(T::GetStaticClass());
+ if (!result)
+ {
+ result = New();
+ result->SetParent(this, false, false);
+ }
+ return result;
+ }
+
///
/// Gets the child actors of the given type.
///