Impact CFX API 1.5.0
Comprehensive API documentation for Impact CFX - Collision Effects System
Loading...
Searching...
No Matches
ImpactCFX.GameObjectExtensions Class Reference

Extensions for working with GameObjects. More...

Static Public Member Functions

static T GetOrAddComponent< T > (this GameObject gameObject, bool checkParents)
 Either gets a component on the given game object or adds one.
 
static bool ShareParent (Transform a, Transform b, Transform parent=null)
 Checks if both of the given transforms have the same parent.
 
static bool HasParent (Transform a, Transform parent)
 Checks if the given transform has the given parent.
 

Detailed Description

Extensions for working with GameObjects.

Member Function Documentation

◆ GetOrAddComponent< T >()

static T ImpactCFX.GameObjectExtensions.GetOrAddComponent< T > ( this GameObject  gameObject,
bool  checkParents 
)
static

Either gets a component on the given game object or adds one.

Template Parameters
TThe component type.
Parameters
gameObjectThe game object to get or add the component to.
checkParentsShould we look for the component in parent objects?
Returns
A reference to the existing or new component.
Type Constraints
T :Component 

◆ HasParent()

static bool ImpactCFX.GameObjectExtensions.HasParent ( Transform  a,
Transform  parent 
)
static

Checks if the given transform has the given parent.

Parameters
aThe transform.
parentParent to check for.
Returns
True if the transform has the parent, false otherwise.

◆ ShareParent()

static bool ImpactCFX.GameObjectExtensions.ShareParent ( Transform  a,
Transform  b,
Transform  parent = null 
)
static

Checks if both of the given transforms have the same parent.

Parameters
aThe first transform.
bThe second transform.
parentOptional parent to check for. If null, the root parent of both transforms will be checked.