Add Actor.HasScene and Script.HasScene
Useful in managed code to check the existence of the scene in hot paths by avoiding expensive marshalling of the Scene object.
This commit is contained in:
@@ -382,6 +382,15 @@ public:
|
||||
return _isActiveInHierarchy != 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets value indicating if actor is in a scene.
|
||||
/// </summary>
|
||||
API_PROPERTY(Attributes="HideInEditor, NoSerialize")
|
||||
FORCE_INLINE bool HasScene() const
|
||||
{
|
||||
return _scene != nullptr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if object is fully static on the scene, otherwise false.
|
||||
/// </summary>
|
||||
|
||||
@@ -17,6 +17,12 @@ namespace FlaxEngine
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets value indicating if the actor owning the script is in a scene.
|
||||
/// </summary>
|
||||
[HideInEditor, NoSerialize]
|
||||
public bool HasScene => Actor?.HasScene ?? false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the world space transformation of the actors owning this script.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user