Class TransformExtensions
Unity Transform
extension methods.
Inheritance
Inherited Members
Namespace: StansAssets.Foundation.Extensions
Assembly: cs.temp.dll.dll
Syntax
public static class TransformExtensions
Methods
ClearHierarchy(Transform, Boolean)
Removes all transform children.
Declaration
public static void ClearHierarchy(this Transform transform, bool activeOnly = false)
Parameters
Type | Name | Description |
---|---|---|
Transform | transform | Transform component. |
System.Boolean | activeOnly | Will ignore disabled game-objects when set to |
FindChildRecursively(Transform, String)
Searches for a child with the provided name across the whole game objects hierarchy.
Declaration
public static Transform FindChildRecursively(this Transform transform, string childName)
Parameters
Type | Name | Description |
---|---|---|
Transform | transform | Transform component. |
System.String | childName | Child name. |
Returns
Type | Description |
---|---|
Transform | Child |
FindOrCreateChild(Transform, String)
Find or create child with name.
Declaration
public static Transform FindOrCreateChild(this Transform transform, string name)
Parameters
Type | Name | Description |
---|---|---|
Transform | transform | Transform component. |
System.String | name | Child name. |
Returns
Type | Description |
---|---|
Transform | Child |
Reset(Transform, Space)
Reset
Declaration
public static void Reset(this Transform transform, Space relativeTo = null)
Parameters
Type | Name | Description |
---|---|---|
Transform | transform | Transform component. |
Space | relativeTo | Space enum the Reset method relative to. Space.Self (default value) resets local space values. Space.World resets absolute world space values. Using World space may cause visual deformations, which depends on a parent's scale |
SetLossyScale(Transform, Vector3)
Sets
Declaration
public static void SetLossyScale(this Transform transform, Vector3 lossyScale)
Parameters
Type | Name | Description |
---|---|---|
Transform | transform | Transform component. |
Vector3 | lossyScale | New lossyScale value. |
SetStatic(Transform, Boolean)
Sets the
Declaration
public static void SetStatic(this Transform transform, bool includeChildren = false)
Parameters
Type | Name | Description |
---|---|---|
Transform | transform | Transform component. |
System.Boolean | includeChildren | If true, the Static flag will be set to it's children as well. |