Extensions for working with GameObjects.
More...
|
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.
|
|
Extensions for working with GameObjects.
◆ 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
-
- Parameters
-
gameObject | The game object to get or add the component to. |
checkParents | Should we look for the component in parent objects? |
- Returns
- A reference to the existing or new component.
◆ HasParent()
static bool ImpactCFX.GameObjectExtensions.HasParent |
( |
Transform |
a, |
|
|
Transform |
parent |
|
) |
| |
|
static |
Checks if the given transform has the given parent.
- Parameters
-
a | The transform. |
parent | Parent 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
-
a | The first transform. |
b | The second transform. |
parent | Optional parent to check for. If null, the root parent of both transforms will be checked. |