Show / Hide Table of Contents

Class TransformExtensions

Inheritance
System.Object
TransformExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Liminal.SDK.Extensions
Assembly: Liminal.SDK.dll
Syntax
public static class TransformExtensions

Methods

| Improve this Doc View Source

GetOrAddComponent(Transform, Type)

Declaration
public static Component GetOrAddComponent(this Transform transform, Type type)
Parameters
Type Name Description
UnityEngine.Transform transform
System.Type type
Returns
Type Description
UnityEngine.Component
| Improve this Doc View Source

GetOrAddComponent<T>(Transform)

Returns the component of the specified type on the transform, or if the component does not exist, adds it to the transform's GameObject and then returns the new component.

Declaration
public static T GetOrAddComponent<T>(this Transform transform)
    where T : Component
Parameters
Type Name Description
UnityEngine.Transform transform

The transform to retrieve the component from or add the component to.

Returns
Type Description
T

The existing component of the specified type on transform, or the newly created component if one does not already exist.

Type Parameters
Name Description
T

The component type

| Improve this Doc View Source

HasComponent<T>(Transform)

Returns a boolean value indicating if the specified Transform has a component of the specified type.

Declaration
public static bool HasComponent<T>(this Transform transform)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform to operate on.

Returns
Type Description
System.Boolean

A boolean value indicating if the supplied UnityEngine.Transform has a component of the specified type.

Type Parameters
Name Description
T

The component type

| Improve this Doc View Source

Identity(Transform)

Resets the transform to its identity state, where UnityEngine.Transform.localPosition is equal to UnityEngine.Vector3.zero, UnityEngine.Transform.localRotation is equal to UnityEngine.Quaternion.identity and UnityEngine.Transform.localScale is equal to UnityEngine.Vector3.one.

Declaration
public static void Identity(this Transform transform)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform to reset to its identity state.

| Improve this Doc View Source

IsDescendentOf(Transform, Transform)

Indicates if this Transform is a descendent of the supplied ancestor Transform.

Declaration
public static bool IsDescendentOf(this Transform transform, Transform ancestor)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

UnityEngine.Transform ancestor

The ancestor transform.

Returns
Type Description
System.Boolean

A boolean value indicating if this Transform is a descendent of the supplied ancestor Transform.

| Improve this Doc View Source

SetParentAndIdentity(Transform, Transform)

Sets the parent of the transform and resets it to its identity state once it has been reparented. This is synonymous with calling UnityEngine.Transform.SetParent(UnityEngine.Transform) followed by Identity(Transform).

Declaration
public static void SetParentAndIdentity(this Transform transform, Transform parent)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform to reparent.

UnityEngine.Transform parent

The new parent of transform

  • Improve this Doc
  • View Source
Back to top Generated by DocFX