コード例 #1
0
 /// <summary>
 /// Gets all components in the hierarchy, by iterating through "hierarchy levels" instead of plain recusivity as
 /// GetComponentsInChildren() would do.
 /// </summary>
 /// <param name="_ComponentType">The type of the components you want to get.</param>
 /// <param name="_IncludeSelf">If enabled, includes the given source object in the resulting list.</param>
 /// <param name="_IncludeInactive">If enabled, includes the inactive objects in the resulting list.</param>
 /// <returns>Returns all the components of the given type found in the hierarchy.</returns>
 public static Component[] GetComponentsInHierarchy(this Component _Obj, Type _ComponentType, bool _IncludeSelf = true, bool _IncludeInactive = false)
 {
     return(GameObjectExtension.GetComponentsInHierarchy(_Obj.gameObject, _ComponentType, _IncludeSelf, _IncludeInactive));
 }
コード例 #2
0
 /// <summary>
 /// Gets all components in the hierarchy, by iterating through "hierarchy levels" instead of plain recusivity as
 /// GetComponentsInChildren() would do.
 /// </summary>
 /// <typeparam name="T">The type of the components you want to get.</typeparam>
 /// <param name="_IncludeSelf">If enabled, includes the given source object in the resulting list.</param>
 /// <param name="_IncludeInactive">If enabled, includes the inactive objects in the resulting list.</param>
 /// <returns>Returns all the components of the given type found in the hierarchy.</returns>
 public static T[] GetComponentsInHierarchy <T>(this Component _Obj, bool _IncludeSelf = true, bool _IncludeInactive = false)
     where T : Component
 {
     return(GameObjectExtension.GetComponentsInHierarchy <T>(_Obj.gameObject, _IncludeSelf, _IncludeInactive));
 }