UnityEssentials
Small but useful tools and features for Unity
Static Public Member Functions | List of all members
UnityEngine.TransformExtensions Class Reference

Extensions for the Transform component More...

Collaboration diagram for UnityEngine.TransformExtensions:
Collaboration graph

Static Public Member Functions

static void ResetTransform (this Transform self)
 Sets the transform position, rotation and scale to the default values. Position = (0,0,0), Rotation = Quaternion.identity, Scale = (1,1,1). More...
 
static void SetProperties (this Transform self, Transform properties)
 Sets the transform position, rotation and scale to the same values in the given transform. More...
 
static void SetProperties (this Transform self, Vector3 position, Quaternion rotation, Vector3 scale)
 Sets the transform position, rotation and scale to the given values. More...
 
static void SetProperties (this Transform self, Quaternion rotation, Vector3 scale)
 Sets the transform rotation and scale to the given values. More...
 
static void SetProperties (this Transform self, Vector3 position, Vector3 scale)
 Sets the transform position and scale to the given values. More...
 
static void SetProperties (this Transform self, Vector3 position, Quaternion rotation)
 Sets the transform position and rotation to the given values. More...
 
static Quaternion GetLookAtRotation (this Transform self, Vector3 target)
 Find the rotation to look at a target. More...
 
static Quaternion GetLookAtRotation (this Transform self, Transform target)
 Find the rotation to look at a target. More...
 
static void LookAway (this Transform self, Vector3 target)
 Instantly look in the opposite direction of the target. More...
 
static void LookAway (this Transform self, Transform target)
 Instantly look in the opposite direction of the target. More...
 
static Quaternion GetLookAwayRotation (this Transform self, Vector3 target)
 Find the rotation to look in the opposite direction of the target. More...
 
static Quaternion GetLookAwayRotation (this Transform self, Transform target)
 Find the rotation to look away from a target transform. More...
 
static void SetLerp (this Transform self, Transform a, Transform b, float t)
 Linearly interpolates between two transforms. More...
 
static void DestroyImmediateAllChildren (this Transform self, IEnumerable< Transform > exceptions=null)
 Destroys immediately the children of a transform. More...
 
static void DestroyAllChildren (this Transform self, IEnumerable< Transform > exceptions=null)
 Destroys the children of a transform. More...
 

Detailed Description

Extensions for the Transform component

Definition at line 9 of file TransformExtensions.cs.

Member Function Documentation

◆ DestroyAllChildren()

static void UnityEngine.TransformExtensions.DestroyAllChildren ( this Transform  self,
IEnumerable< Transform >  exceptions = null 
)
static

Destroys the children of a transform.

Parameters
exceptionsTransforms that must not be destroyed.

Definition at line 154 of file TransformExtensions.cs.

◆ DestroyImmediateAllChildren()

static void UnityEngine.TransformExtensions.DestroyImmediateAllChildren ( this Transform  self,
IEnumerable< Transform >  exceptions = null 
)
static

Destroys immediately the children of a transform.

This method is not recommended to use. Instead use 'DestroyAllChildren'."

Parameters
exceptionsTransforms that must not be destroyed.

Definition at line 140 of file TransformExtensions.cs.

◆ GetLookAtRotation() [1/2]

static Quaternion UnityEngine.TransformExtensions.GetLookAtRotation ( this Transform  self,
Transform  target 
)
static

Find the rotation to look at a target.

Parameters
targetThe thing to look at.
Returns
The needed rotation to look at the target.

Definition at line 84 of file TransformExtensions.cs.

Here is the call graph for this function:

◆ GetLookAtRotation() [2/2]

static Quaternion UnityEngine.TransformExtensions.GetLookAtRotation ( this Transform  self,
Vector3  target 
)
static

Find the rotation to look at a target.

Parameters
targetThe thing to look at.
Returns
The needed rotation to look at the target.

Definition at line 75 of file TransformExtensions.cs.

Here is the caller graph for this function:

◆ GetLookAwayRotation() [1/2]

static Quaternion UnityEngine.TransformExtensions.GetLookAwayRotation ( this Transform  self,
Transform  target 
)
static

Find the rotation to look away from a target transform.

Parameters
targetThe thing to look away from.
Returns
The needed rotation to look away from the target.

Definition at line 121 of file TransformExtensions.cs.

Here is the call graph for this function:

◆ GetLookAwayRotation() [2/2]

static Quaternion UnityEngine.TransformExtensions.GetLookAwayRotation ( this Transform  self,
Vector3  target 
)
static

Find the rotation to look in the opposite direction of the target.

Parameters
targetThe thing to look away from.
Returns
The needed rotation to look away from the target.

Definition at line 111 of file TransformExtensions.cs.

Here is the caller graph for this function:

◆ LookAway() [1/2]

static void UnityEngine.TransformExtensions.LookAway ( this Transform  self,
Transform  target 
)
static

Instantly look in the opposite direction of the target.

Parameters
targetThe thing to look away from.

Definition at line 101 of file TransformExtensions.cs.

Here is the call graph for this function:

◆ LookAway() [2/2]

static void UnityEngine.TransformExtensions.LookAway ( this Transform  self,
Vector3  target 
)
static

Instantly look in the opposite direction of the target.

Parameters
targetThe thing to look away from

Definition at line 93 of file TransformExtensions.cs.

Here is the call graph for this function:

◆ ResetTransform()

static void UnityEngine.TransformExtensions.ResetTransform ( this Transform  self)
static

Sets the transform position, rotation and scale to the default values. Position = (0,0,0), Rotation = Quaternion.identity, Scale = (1,1,1).

Definition at line 14 of file TransformExtensions.cs.

◆ SetLerp()

static void UnityEngine.TransformExtensions.SetLerp ( this Transform  self,
Transform  a,
Transform  b,
float  t 
)
static

Linearly interpolates between two transforms.

When t = 0 returns a. When t = 1 returns b. When t = 0.5 returns the point midway between a and b.

Definition at line 130 of file TransformExtensions.cs.

◆ SetProperties() [1/5]

static void UnityEngine.TransformExtensions.SetProperties ( this Transform  self,
Quaternion  rotation,
Vector3  scale 
)
static

Sets the transform rotation and scale to the given values.

Parameters
rotationThe rotation to be set in the transform.
scaleThe scale to be set in the transform.

Definition at line 44 of file TransformExtensions.cs.

◆ SetProperties() [2/5]

static void UnityEngine.TransformExtensions.SetProperties ( this Transform  self,
Transform  properties 
)
static

Sets the transform position, rotation and scale to the same values in the given transform.

Parameters
propertiesThe transform from which the position, rotation and scale will be copied.

Definition at line 23 of file TransformExtensions.cs.

◆ SetProperties() [3/5]

static void UnityEngine.TransformExtensions.SetProperties ( this Transform  self,
Vector3  position,
Quaternion  rotation 
)
static

Sets the transform position and rotation to the given values.

Parameters
positionThe position to be set in the transform.
rotationThe rotation to be set in the transform.

Definition at line 64 of file TransformExtensions.cs.

◆ SetProperties() [4/5]

static void UnityEngine.TransformExtensions.SetProperties ( this Transform  self,
Vector3  position,
Quaternion  rotation,
Vector3  scale 
)
static

Sets the transform position, rotation and scale to the given values.

Parameters
positionThe position to be set in the transform.
rotationThe rotation to be set in the transform.
scaleThe scale to be set in the transform.

Definition at line 33 of file TransformExtensions.cs.

◆ SetProperties() [5/5]

static void UnityEngine.TransformExtensions.SetProperties ( this Transform  self,
Vector3  position,
Vector3  scale 
)
static

Sets the transform position and scale to the given values.

Parameters
positionThe position to be set in the transform.
scaleThe scale to be set in the transform.

Definition at line 54 of file TransformExtensions.cs.


The documentation for this class was generated from the following file: