Class RigConstraint<TJob, TData, TBinder>
This is the base class for rig constraints. Inherit from this class to implement custom constraints.
Inherited Members
Namespace: UnityEngine.Animations.Rigging
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(0F, 1F)]
protected float m_Weight
Field Value
Type | Description |
---|---|
Single |
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 |
---|---|
Single |
Implements
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. |
Implements
DestroyJob(IAnimationJob)
Frees the specified job memory.
Declaration
public void DestroyJob(IAnimationJob job)
Parameters
Type | Name | Description |
---|---|---|
IAnimationJob | job | The job to destroy. |
Implements
IsValid()
Retrieves the constraint valid state.
Declaration
public bool IsValid()
Returns
Type | Description |
---|---|
Boolean | Returns true if constraint data can be successfully evaluated. Returns false otherwise. |
Implements
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. |
Implements
Explicit Interface Implementations
IRigConstraint.binder
The job binder for the constraint.
Declaration
IAnimationJobBinder IRigConstraint.binder { get; }
Returns
Type | Description |
---|---|
IAnimationJobBinder |
Implements
IRigConstraint.component
The component for the constraint.
Declaration
Component IRigConstraint.component { get; }
Returns
Type | Description |
---|---|
Component |
Implements
IRigConstraint.data
The data container for the constraint.
Declaration
IAnimationJobData IRigConstraint.data { get; }
Returns
Type | Description |
---|---|
IAnimationJobData |