Photon Fusion 1.1.2

Static Public Member Functions | List of all members
NestedComponentUtilities Class Reference

Tools to replace GetComponent variants that respects nested objects. These are used to find components of a NetworkedObjects without also finding components that belong to parent or child NetworkedObjects. More...

Static Public Member Functions

static T EnsureRootComponentExists< T, StopOnT > (this Transform transform)
 
static T GetParentComponent< T > (this Transform t)
 Find T on supplied transform or any parent. Unlike GetComponentInParent, GameObjects do not need to be active to be found. More...
 
static void GetNestedComponentsInParents< T > (this Transform t, List< T > list)
 Returns all T found between the child transform and its root. Order in List from child to parent, with the root/parent most being last. More...
 
static T GetNestedComponentInChildren< T, StopOnT > (this Transform t, bool includeInactive)
 
static T GetNestedComponentInParent< T, StopOnT > (this Transform t)
 Same as GetComponentInParent, but will always include inactive objects in search. Will also stop recursing up the hierarchy when the StopOnT is found. More...
 
static T GetNestedComponentInParents< T, StopOnT > (this Transform t)
 UNTESTED More...
 
static void GetNestedComponentsInParents< T, StopT > (this Transform t, List< T > list)
 Finds components of type T on supplied transform, and every parent above that node, inclusively stopping on node StopT component. More...
 
static List< T > GetNestedComponentsInChildren< T, StopOnT > (this Transform t, List< T > list, bool includeInactive=true)
 Same as GetComponentsInChildren, but will not recurse into children with component of the StopT type. More...
 
static List< T > GetNestedComponentsInChildren< T > (this Transform t, List< T > list, bool includeInactive=true, params System.Type[] stopOn)
 Same as GetComponentsInChildren, but will not recurse into children with any component of the types in the stopOn array. More...
 
static void GetNestedComponentsInChildren< T, SearchT, StopT > (this Transform t, bool includeInactive, List< T > list)
 Same as GetComponentsInChildren, but will not recurse into children with component of the StopT type. More...
 
static T[] FindObjectsOfTypeInOrder< T > (this UnityEngine.SceneManagement.Scene scene, bool includeInactive=false)
 Find All instances of Component type in a scene. Attempts to respect the hierarchy of the scene objects to produce a more deterministic order. This is a slower operation, and does produce garbage collection. More...
 
static void FindObjectsOfTypeInOrder< T > (this UnityEngine.SceneManagement.Scene scene, List< T > list, bool includeInactive=false)
 Find All instances of Component type in a scene. Attempts to respect the hierarchy of the scene objects to produce a more deterministic order. This is a slower operation which should not be run every update. More...
 
static CastT[] FindObjectsOfTypeInOrder< T, CastT > (this UnityEngine.SceneManagement.Scene scene, bool includeInactive=false)
 Find All instances of Component type in a scene. Attempts to respect the hierarchy of the scene objects to produce a more deterministic order. This is a slow operation, and does produce garbage collection. More...
 
static void FindObjectsOfTypeInOrder< T, CastT > (this UnityEngine.SceneManagement.Scene scene, List< CastT > list, bool includeInactive=false)
 Find All instances of Component type in a scene. Attempts to respect the hierarchy of the scene objects to produce a more deterministic order. This is a slower operation and should not be run every update. More...
 
static T[] FindObjectOfTypeInOrder< T > (this UnityEngine.SceneManagement.Scene scene)
 
static CastT[] FindObjectOfTypeInOrder< T, CastT > (this UnityEngine.SceneManagement.Scene scene)
 

Detailed Description

Tools to replace GetComponent variants that respects nested objects. These are used to find components of a NetworkedObjects without also finding components that belong to parent or child NetworkedObjects.

Member Function Documentation

◆ FindObjectsOfTypeInOrder< T >() [1/2]

static T [] FindObjectsOfTypeInOrder< T > ( this UnityEngine.SceneManagement.Scene  scene,
bool  includeInactive = false 
)
static

Find All instances of Component type in a scene. Attempts to respect the hierarchy of the scene objects to produce a more deterministic order. This is a slower operation, and does produce garbage collection.

Type Constraints
T :class 

◆ FindObjectsOfTypeInOrder< T >() [2/2]

static void FindObjectsOfTypeInOrder< T > ( this UnityEngine.SceneManagement.Scene  scene,
List< T >  list,
bool  includeInactive = false 
)
static

Find All instances of Component type in a scene. Attempts to respect the hierarchy of the scene objects to produce a more deterministic order. This is a slower operation which should not be run every update.

Template Parameters
T
Parameters
scene
listSupplied list that will be populated by this find.
includeInactiveWhether results should include inactive components.
Type Constraints
T :class 

◆ FindObjectsOfTypeInOrder< T, CastT >() [1/2]

static CastT [] FindObjectsOfTypeInOrder< T, CastT > ( this UnityEngine.SceneManagement.Scene  scene,
bool  includeInactive = false 
)
static

Find All instances of Component type in a scene. Attempts to respect the hierarchy of the scene objects to produce a more deterministic order. This is a slow operation, and does produce garbage collection.

Template Parameters
TThe type being searched for.
CastTCasts all found objects to this type, and returns collection of this type. Objects that fail cast are excluded.
Parameters
scene
includeInactiveWhether results should include inactive components.
Type Constraints
T :class 
CastT :class 

◆ FindObjectsOfTypeInOrder< T, CastT >() [2/2]

static void FindObjectsOfTypeInOrder< T, CastT > ( this UnityEngine.SceneManagement.Scene  scene,
List< CastT >  list,
bool  includeInactive = false 
)
static

Find All instances of Component type in a scene. Attempts to respect the hierarchy of the scene objects to produce a more deterministic order. This is a slower operation and should not be run every update.

Template Parameters
T
CastT
Parameters
scene
listSupplied list that will be filled with found objects.
includeInactiveWhether results should include inactive components.
Type Constraints
T :class 
CastT :class 

◆ GetNestedComponentInParent< T, StopOnT >()

static T GetNestedComponentInParent< T, StopOnT > ( this Transform  t)
static

Same as GetComponentInParent, but will always include inactive objects in search. Will also stop recursing up the hierarchy when the StopOnT is found.

Type Constraints
T :class 
StopOnT :class 

◆ GetNestedComponentInParents< T, StopOnT >()

static T GetNestedComponentInParents< T, StopOnT > ( this Transform  t)
static

UNTESTED

Type Constraints
T :class 
StopOnT :class 

◆ GetNestedComponentsInChildren< T >()

static List<T> GetNestedComponentsInChildren< T > ( this Transform  t,
List< T >  list,
bool  includeInactive = true,
params System.Type[]  stopOn 
)
static

Same as GetComponentsInChildren, but will not recurse into children with any component of the types in the stopOn array.

Type Constraints
T :class 

◆ GetNestedComponentsInChildren< T, SearchT, StopT >()

static void GetNestedComponentsInChildren< T, SearchT, StopT > ( this Transform  t,
bool  includeInactive,
List< T >  list 
)
static

Same as GetComponentsInChildren, but will not recurse into children with component of the StopT type.

Template Parameters
TCast found components to this type. Typically Component, but any other class/interface will work as long as they are assignable from SearchT.
SearchTFind components of this class or interface type.
StopTWhen this component is found, no further recursing will be performed on that node.
Type Constraints
T :class 
SearchT :class 

◆ GetNestedComponentsInChildren< T, StopOnT >()

static List<T> GetNestedComponentsInChildren< T, StopOnT > ( this Transform  t,
List< T >  list,
bool  includeInactive = true 
)
static

Same as GetComponentsInChildren, but will not recurse into children with component of the StopT type.

Type Constraints
T :class 
StopOnT :class 

◆ GetNestedComponentsInParents< T >()

static void GetNestedComponentsInParents< T > ( this Transform  t,
List< T >  list 
)
static

Returns all T found between the child transform and its root. Order in List from child to parent, with the root/parent most being last.

Type Constraints
T :Component 

◆ GetNestedComponentsInParents< T, StopT >()

static void GetNestedComponentsInParents< T, StopT > ( this Transform  t,
List< T >  list 
)
static

Finds components of type T on supplied transform, and every parent above that node, inclusively stopping on node StopT component.

Type Constraints
T :class 
StopT :class 

◆ GetParentComponent< T >()

static T GetParentComponent< T > ( this Transform  t)
static

Find T on supplied transform or any parent. Unlike GetComponentInParent, GameObjects do not need to be active to be found.

Type Constraints
T :Component