Class RigConstraint<TJob, TData, TBinder>
This is the base class for rig constraints. Inherit from this class to implement custom constraints.
Implements
Inherited Members
Namespace: UnityEngine.Animations.Rigging
Assembly: Unity.Animation.Rigging.dll
Syntax
public class RigConstraint<TJob, TData, TBinder> : MonoBehaviour, IRigConstraint where TJob : struct, IWeightedAnimationJob where TData : struct, IAnimationJobData where TBinder : AnimationJobBinder<TJob, TData>, new()
  Type Parameters
| Name | Description | 
|---|---|
| TJob | The constraint job  | 
      
| TData | The constraint data  | 
      
| TBinder | The constraint job binder  | 
      
Fields
m_Data
The constraint data.
Declaration
[SerializeField]
protected TData m_Data
  Field Value
| Type | Description | 
|---|---|
| TData | 
m_Weight
The constraint weight parameter.
Declaration
[SerializeField]
[Range(0, 1)]
protected float m_Weight
  Field Value
| Type | Description | 
|---|---|
| float | 
Properties
data
The data container for the constraint.
Declaration
public ref TData data { get; }
  Property Value
| Type | Description | 
|---|---|
| TData | 
weight
The constraint weight. This is a value in between 0 and 1.
Declaration
public float weight { get; set; }
  Property Value
| Type | Description | 
|---|---|
| float | 
Methods
CreateJob(Animator)
Creates the animation job for this constraint.
Declaration
public IAnimationJob CreateJob(Animator animator)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Animator | animator | The animated hierarchy Animator component  | 
      
Returns
| Type | Description | 
|---|---|
| IAnimationJob | Returns the newly instantiated job.  | 
      
DestroyJob(IAnimationJob)
Frees the specified job memory.
Declaration
public void DestroyJob(IAnimationJob job)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IAnimationJob | job | The job to destroy.  | 
      
IsValid()
Retrieves the constraint valid state.
Declaration
public bool IsValid()
  Returns
| Type | Description | 
|---|---|
| bool | Returns true if constraint data can be successfully evaluated. Returns false otherwise.  | 
      
OnValidate()
This function is called when the script is loaded or a value is changed in the Inspector (Called in the editor only). You can use this to ensure that when you modify data in an editor, that data stays within a certain range.
Declaration
protected virtual void OnValidate()
  Reset()
Resets constraint data to default values.
Declaration
public void Reset()
  UpdateJob(IAnimationJob)
Updates the specified job data.
Declaration
public void UpdateJob(IAnimationJob job)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IAnimationJob | job | The job to update.  |