Skip to content

ComponentExtensions

Namespace: SideXP.Core

public static class ComponentExtensions

Extension functions for Component objects.

Methods

InstantiateGameObject<T>(T, Vector3, Quaternion, Transform, GameObject)

public static T InstantiateGameObject<T>(T component, Vector3 position, Quaternion rotation, Transform parent, out GameObject gameObject)

Creates an instance of the GameObject to which the component is attached.

Type parameters

  • T: The type of the attached component.

Parameters

  • component: The attached component.
  • gameObject: Outputs the new GameObject instance.

Returns

Returns the component

InstantiateGameObject<T>(T, Vector3, Quaternion, Transform)

public static T InstantiateGameObject<T>(T component, Vector3 position, Quaternion rotation, Transform parent)

Creates an instance of the GameObject to which the component is attached.

Type parameters

  • T: The type of the attached component.

Parameters

  • component: The attached component.

Returns

Returns the component

InstantiateGameObject<T>(T, Transform, GameObject, bool)

public static T InstantiateGameObject<T>(T component, Transform parent, out GameObject gameObject, bool instantiateInWorldSpace = false)

Creates an instance of the GameObject to which the component is attached.

Type parameters

  • T: The type of the attached component.

Parameters

  • component: The attached component.
  • gameObject: Outputs the new GameObject instance.

Returns

Returns the component

InstantiateGameObject<T>(T, Transform, bool)

public static T InstantiateGameObject<T>(T component, Transform parent, bool instantiateInWorldSpace = false)

Inherited documentation.

InstantiateGameObject<T>(T, GameObject)

public static T InstantiateGameObject<T>(T component, out GameObject gameObject)

Creates an instance of the GameObject to which the component is attached.

Type parameters

  • T: The type of the attached component.

Parameters

  • component: The attached component.
  • gameObject: Outputs the new GameObject instance.

Returns

Returns the component

InstantiateGameObject<T>(T)

public static T InstantiateGameObject<T>(T component)

Inherited documentation.

TryGetComponentInParent(Component, Type, Component, bool)

public static bool TryGetComponentInParent(Component component, Type componentType, out Component output, bool includeInactive)

Parameters

  • component: The component from which to get the target one.
  • componentType
  • output: Outputs the found component of the given type.

Returns

Returns true if a component of the expected type has been found on the given component's Game Object, or its parent.

TryGetComponentInParent(Component, Type, Component)

public static bool TryGetComponentInParent(Component component, Type componentType, out Component output)

Parameters

  • component: The component from which to get the target one.
  • componentType
  • output: Outputs the found component of the given type.

Returns

Returns true if a component of the expected type has been found on the given component's Game Object, or its parent.

TryGetComponentInParent<T>(Component, T, bool)

public static bool TryGetComponentInParent<T>(Component component, out T output, bool includeInactive)

Inherited documentation.

TryGetComponentInParent<T>(Component, T)

public static bool TryGetComponentInParent<T>(Component component, out T output)

Inherited documentation.

TryGetComponentInChildren(Component, Type, Component, bool)

public static bool TryGetComponentInChildren(Component component, Type componentType, out Component output, bool includeInactive)

Parameters

  • component: The component from which to get the target one.
  • componentType
  • output: Outputs the found component of the given type.

Returns

Returns true if a component of the expected type has been found on the given component's Game Object, or its children.

TryGetComponentInChildren(Component, Type, Component)

public static bool TryGetComponentInChildren(Component component, Type componentType, out Component output)

Parameters

  • component: The component from which to get the target one.
  • componentType
  • output: Outputs the found component of the given type.

Returns

Returns true if a component of the expected type has been found on the given component's Game Object, or its children.

TryGetComponentInChildren<T>(Component, T, bool)

public static bool TryGetComponentInChildren<T>(Component component, out T output, bool includeInactive)

Inherited documentation.

TryGetComponentInChildren<T>(Component, T)

public static bool TryGetComponentInChildren<T>(Component component, out T output)

Inherited documentation.

GetComponentsInChildren<T>(Component, bool, bool)

public static T[] GetComponentsInChildren<T>(Component component, bool includeInactive, bool excludeSelf)

Custom version of GetComponentsInChildren<T> that allows you to exclude the parent object.

Type parameters

  • T: The type of components to find.

Parameters

  • includeInactive: If enabled, inactive objects will be queried too.
  • excludeSelf: If enabled and the given parent has a component of the given type, that component will be ignored.

Returns

Returns the queried components.