Show / Hide Table of Contents

Class TransformExtensions

Unity Transform extension methods.

Inheritance
System.Object
TransformExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
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 true.

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 component instance.

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 component instance.

Reset(Transform, Space)

Reset component position, scale and rotation.

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 value.

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 's Static flag.

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.

In This Article
Back to top Generated by DocFX