diff --git a/Source/Engine/Level/Actor.cs b/Source/Engine/Level/Actor.cs index 7258f8514..fe24136d3 100644 --- a/Source/Engine/Level/Actor.cs +++ b/Source/Engine/Level/Actor.cs @@ -224,6 +224,26 @@ namespace FlaxEngine return script != null; } + /// + /// Tries to find the script of the given type in this actor hierarchy (checks this actor and all children hierarchy). + /// + /// Type of the object. + /// Script instance if found, null otherwise. + public T FindScript() where T : Script + { + return FindScript(typeof(T)) as T; + } + + /// + /// Tries to find the actor of the given type in this actor hierarchy (checks this actor and all children hierarchy). + /// + /// Type of the object. + /// Actor instance if found, null otherwise. + public T FindActor() where T : Actor + { + return FindActor(typeof(T)) as T; + } + /// /// Searches for all actors of a specific type in this actor children list. ///