diff --git a/Source/Engine/Level/Actor.cpp b/Source/Engine/Level/Actor.cpp index a0aa01cba..388379237 100644 --- a/Source/Engine/Level/Actor.cpp +++ b/Source/Engine/Level/Actor.cpp @@ -489,6 +489,13 @@ void Actor::AddTag(const Tag& tag) Tags.AddUnique(tag); } +void Actor::AddTagRecursive(const Tag& tag) +{ + for (const auto& child : Children) + child->AddTagRecursive(tag); + Tags.AddUnique(tag); +} + PRAGMA_DISABLE_DEPRECATION_WARNINGS const String& Actor::GetTag() const diff --git a/Source/Engine/Level/Actor.h b/Source/Engine/Level/Actor.h index 7a75b12f7..31cfe2473 100644 --- a/Source/Engine/Level/Actor.h +++ b/Source/Engine/Level/Actor.h @@ -120,7 +120,7 @@ public: API_PROPERTY() void SetLayerName(const StringView& value); /// - /// Sets the name of the layer recursively for all underlying children. + /// Sets the name of the layer recursively for actor and for all underlying child actors. /// API_FUNCTION() void SetLayerNameRecursive(const StringView& value); @@ -147,6 +147,12 @@ public: /// The tag to add. API_FUNCTION() void AddTag(const Tag& tag); + /// + /// Adds a tag to the actor and for all underlying child actors. + /// + /// The tag to add. + API_FUNCTION() void AddTagRecursive(const Tag& tag); + /// /// Gets the name of the tag. /// [Deprecated in v1.5]