Add Script::IsEnabledInHierarchy

This commit is contained in:
Wojtek Figat
2025-03-27 21:05:32 +01:00
parent 38b00f458c
commit 0041a17b7d
2 changed files with 10 additions and 0 deletions

View File

@@ -63,6 +63,11 @@ void Script::SetEnabled(bool value)
}
}
bool Script::IsEnabledInHierarchy() const
{
return _enabled && (_parent == nullptr || _parent->IsActiveInHierarchy());
}
Actor* Script::GetActor() const
{
return _parent;

View File

@@ -42,6 +42,11 @@ public:
/// </summary>
API_PROPERTY() void SetEnabled(bool value);
/// <summary>
/// Gets value indicating if script is enabled and active in the scene graph. It must be active as well as all it's parents.
/// </summary>
API_PROPERTY(Attributes="HideInEditor, NoSerialize") bool IsEnabledInHierarchy() const;
/// <summary>
/// Gets the actor owning that script.
/// </summary>