Class Transforms
Inheritance
System.Object
Transforms
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.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: GameKit.Dependencies.Utilities
Assembly: GameKit.Dependencies.dll
Syntax
public static class Transforms
Methods
DestroyChildren(Transform, Boolean)
Destroys all children under the specified transform.
Declaration
public static void DestroyChildren(this Transform t, bool destroyImmediately = false)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | t | |
System.Boolean | destroyImmediately |
DestroyChildren<T>(Transform, Boolean)
Destroys all children of a type under the specified transform.
Declaration
public static void DestroyChildren<T>(this Transform t, bool destroyImmediately = false)
where T : MonoBehaviour
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | t | |
System.Boolean | destroyImmediately |
Type Parameters
Name | Description |
---|---|
T |
GetComponentsInChildren<T>(Transform, List<T>, Boolean, Boolean)
Gets components in children and optionally parent.
Declaration
public static void GetComponentsInChildren<T>(this Transform parent, List<T> results, bool includeParent = true, bool includeInactive = false)
where T : Component
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | parent | |
System.Collections.Generic.List<T> | results | |
System.Boolean | includeParent | |
System.Boolean | includeInactive |
Type Parameters
Name | Description |
---|---|
T |
GetOnScreenPosition(RectTransform, Vector3, Vector2)
Returns a position for the rectTransform ensuring it's fully on the screen.
Declaration
public static Vector3 GetOnScreenPosition(this RectTransform rectTransform, Vector3 desiredPosition, Vector2 padding)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.RectTransform | rectTransform | |
UnityEngine.Vector3 | desiredPosition | Preferred position for the rectTransform. |
UnityEngine.Vector2 | padding | How much padding the transform must be from the screen edges. |
Returns
Type | Description |
---|---|
UnityEngine.Vector3 |
GetPosition(Transform, Boolean)
Returns the position of this transform.
Declaration
public static Vector3 GetPosition(this Transform t, bool localSpace)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | t | |
System.Boolean | localSpace |
Returns
Type | Description |
---|---|
UnityEngine.Vector3 |
GetRotation(Transform, Boolean)
Returns the rotation of this transform.
Declaration
public static Quaternion GetRotation(this Transform t, bool localSpace)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | t | |
System.Boolean | localSpace |
Returns
Type | Description |
---|---|
UnityEngine.Quaternion |
GetScale(Transform)
Returns the scale of this transform.
Declaration
public static Vector3 GetScale(this Transform t)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | t |
Returns
Type | Description |
---|---|
UnityEngine.Vector3 |
HalfSizeDelta(RectTransform, Boolean)
Returns the sizeDelta halfed.
Declaration
public static Vector2 HalfSizeDelta(this RectTransform rectTransform, bool useScale = false)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.RectTransform | rectTransform | |
System.Boolean | useScale |
Returns
Type | Description |
---|---|
UnityEngine.Vector2 |
SetParentAndKeepTransform(Transform, Transform)
Sets a parent for src while maintaining position, rotation, and scale of src.
Declaration
public static void SetParentAndKeepTransform(this Transform src, Transform parent)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | src | |
UnityEngine.Transform | parent | Transform to become a child of. |
SetPosition(Transform, Boolean, Vector3)
Sets the position of this transform.
Declaration
public static void SetPosition(this Transform t, bool localSpace, Vector3 pos)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | t | |
System.Boolean | localSpace | |
UnityEngine.Vector3 | pos |
SetRotation(Transform, Boolean, Quaternion)
Sets the position of this transform.
Declaration
public static void SetRotation(this Transform t, bool localSpace, Quaternion rot)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | t | |
System.Boolean | localSpace | |
UnityEngine.Quaternion | rot |
SetScale(Transform, Vector3)
Sets the position of this transform.
Declaration
public static void SetScale(this Transform t, Vector3 scale)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | t | |
UnityEngine.Vector3 | scale |
SizeDeltaScaled(RectTransform)
Returns the sizeDelta multiplied by scale.
Declaration
public static Vector2 SizeDeltaScaled(this RectTransform rectTransform)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.RectTransform | rectTransform |
Returns
Type | Description |
---|---|
UnityEngine.Vector2 |