Class TransformExtensions
UnityEngine.Transform Based Extension Methods
Inheritance
Namespace: GDX
Syntax
[VisualScriptingCompatible((short)2)]
public static class TransformExtensions
Methods
| Improve this Doc View SourceDestroyChildren(Transform, Boolean, Boolean, Boolean)
Destroy child UnityEngine.Transform.
Declaration
public static void DestroyChildren(this Transform targetTransform, bool deactivateBeforeDestroy = true, bool destroyInactive = true, bool immediateMode = false)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | targetTransform | The parent UnityEngine.Transform to look at. |
System.Boolean | deactivateBeforeDestroy | Should the |
System.Boolean | destroyInactive | Should inactive UnityEngine.GameObject be destroyed as well? |
System.Boolean | immediateMode | Should the destroy be done immediately? This is useful for author time calls. |
Exceptions
Type | Condition |
---|---|
UnsupportedRuntimeException | Not supported on DOTS Runtime. |
GetActiveChildCount(Transform)
Get the number of immediate children active.
Declaration
public static int GetActiveChildCount(this Transform targetTransform)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | targetTransform | The transform to look at's children. |
Returns
Type | Description |
---|---|
System.Int32 | The number of active children transforms. |
Exceptions
Type | Condition |
---|---|
UnsupportedRuntimeException | Not supported on DOTS Runtime. |
GetFirstComponentInChildrenComplex<T>(Transform, Boolean, Int32, Int32)
Search recursively for a UnityEngine.Component on the targetTransform
.
Declaration
public static T GetFirstComponentInChildrenComplex<T>(this Transform targetTransform, bool includeInactive, int currentDepth, int maxLevelsOfRecursion = -1)
where T : Component
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | targetTransform | The target UnityEngine.Transform to use as the base for the search. |
System.Boolean | includeInactive | Include inactive child UnityEngine.GameObjects when looking for the UnityEngine.Component. |
System.Int32 | currentDepth | Current level of recursion. |
System.Int32 | maxLevelsOfRecursion | The maximum levels of recursion when looking for a UnityEngine.Component, -1 for infinite recursion. |
Returns
Type | Description |
---|---|
T | The first found UnityEngine.Component. |
Type Parameters
Name | Description |
---|---|
T | The target UnityEngine.Component type that is being looked for. |
Exceptions
Type | Condition |
---|---|
UnsupportedRuntimeException | Not supported on DOTS Runtime. |
GetScenePath(Transform)
Get an in scene path to the targetTransform
.
Declaration
public static string GetScenePath(this Transform targetTransform)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | targetTransform | The UnityEngine.Transform which to derive a path from. |
Returns
Type | Description |
---|---|
System.String | A created path System.String. |
Exceptions
Type | Condition |
---|---|
UnsupportedRuntimeException | Not supported on DOTS Runtime. |