diff --git a/Source/Engine/Level/Actor.cpp b/Source/Engine/Level/Actor.cpp
index 8ab195ef1..ef5b2a554 100644
--- a/Source/Engine/Level/Actor.cpp
+++ b/Source/Engine/Level/Actor.cpp
@@ -347,6 +347,12 @@ void Actor::SetOrderInParent(int32 index)
}
}
+Actor* Actor::GetChild(int32 index) const
+{
+ CHECK_RETURN(index >= 0 && index < Children.Count(), nullptr);
+ return Children[index];
+}
+
Actor* Actor::GetChild(const StringView& name) const
{
for (int32 i = 0; i < Children.Count(); i++)
@@ -354,7 +360,6 @@ Actor* Actor::GetChild(const StringView& name) const
if (Children[i]->GetName() == name)
return Children[i];
}
-
return nullptr;
}
@@ -482,6 +487,12 @@ void Actor::SetName(const StringView& value)
Level::callActorEvent(Level::ActorEventType::OnActorNameChanged, this, nullptr);
}
+Script* Actor::GetScript(int32 index) const
+{
+ CHECK_RETURN(index >= 0 && index < Scripts.Count(), nullptr);
+ return Scripts[index];
+}
+
Script* Actor::GetScript(const MClass* type) const
{
CHECK_RETURN(type, nullptr);
diff --git a/Source/Engine/Level/Actor.h b/Source/Engine/Level/Actor.h
index 233ebe04c..560403890 100644
--- a/Source/Engine/Level/Actor.h
+++ b/Source/Engine/Level/Actor.h
@@ -192,10 +192,7 @@ public:
///
/// The child actor index.
/// The child actor (always valid).
- API_FUNCTION() FORCE_INLINE Actor* GetChild(int32 index) const
- {
- return Children[index];
- }
+ API_FUNCTION() Actor* GetChild(int32 index) const;
///
/// Gets the child actor with the given name.
@@ -266,10 +263,7 @@ public:
///
/// The script index.
/// The script (always valid).
- API_FUNCTION() FORCE_INLINE Script* GetScript(int32 index) const
- {
- return Scripts[index];
- }
+ API_FUNCTION() Script* GetScript(int32 index) const;
///
/// Gets the script of the given type from this actor.