Class ProceduralAnimatorComponent
Main MonoBehaviour that drives the procedural animation system. Evaluates rules, computes layer weights, manages action lifecycle, and applies the combined pose delta to the rig.
Namespace: Serenity.ProceduralExpression.Infrastructure.Components
Assembly: Serenity.UnityProceduralExpression.Infrastructure.dll
Syntax
public class ProceduralAnimatorComponent : MonoBehaviour
Constructors
ProceduralAnimatorComponent()
Declaration
public ProceduralAnimatorComponent()
Properties
MaterialApplier
Gets the material applier for advanced configuration. Use RegisterMaterialTarget/UnregisterMaterialTarget for basic usage.
Declaration
public UnityMaterialApplier MaterialApplier { get; }
Property Value
| Type | Description |
|---|---|
| UnityMaterialApplier |
Profile
Gets the profile used for auto-configuration.
Declaration
public ProceduralExpressionProfileSO Profile { get; }
Property Value
| Type | Description |
|---|---|
| ProceduralExpressionProfileSO |
RigDefinition
Gets the rig definition (resolved from component or profile).
Declaration
public UnityRigDefinition RigDefinition { get; }
Property Value
| Type | Description |
|---|---|
| UnityRigDefinition |
StateBus
Gets the state bus component.
Declaration
public StateBusComponent StateBus { get; }
Property Value
| Type | Description |
|---|---|
| StateBusComponent |
UseProfileConfiguration
Gets or sets whether to use Profile configuration instead of local arrays.
Declaration
public bool UseProfileConfiguration { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
GetLayerWeight(ProceduralLayerSO)
Gets the current weight of a layer.
Declaration
public float GetLayerWeight(ProceduralLayerSO layer)
Parameters
| Type | Name | Description |
|---|---|---|
| ProceduralLayerSO | layer |
Returns
| Type | Description |
|---|---|
| float |
ReRegisterMaterialTargetsFromProfile()
Re-registers all material targets from the profile. Call this if materials or shaders are changed at runtime (e.g., Rendering Mode changes). Clears existing targets and re-registers from profile.
Declaration
public void ReRegisterMaterialTargetsFromProfile()
RecacheBasePose()
Re-caches the base pose. Call this if the rig's default pose changes at runtime.
Declaration
public void RecacheBasePose()
RegisterMaterialTarget(string, Renderer, int)
Registers a material target for procedural material animation. Must be called for each material that layers will animate. Uses automatic property detection for the specified material slot.
Declaration
public void RegisterMaterialTarget(string materialId, Renderer renderer, int materialIndex = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| string | materialId | Unique identifier for this material target. |
| Renderer | renderer | The renderer to animate. |
| int | materialIndex | Material slot index (0 for first material). |
ResetAllLayerWeights()
Resets all layer weights to zero.
Declaration
public void ResetAllLayerWeights()
SetLayerWeight(ProceduralLayerSO, float)
Manually sets a layer's target weight.
Declaration
public void SetLayerWeight(ProceduralLayerSO layer, float weight)
Parameters
| Type | Name | Description |
|---|---|---|
| ProceduralLayerSO | layer | |
| float | weight |
StopAllActions()
Stops all active actions immediately.
Declaration
public void StopAllActions()
TriggerAction(ProceduralActionSO)
Manually triggers an action by reference.
Declaration
public void TriggerAction(ProceduralActionSO action)
Parameters
| Type | Name | Description |
|---|---|---|
| ProceduralActionSO | action |
UnregisterMaterialTarget(string)
Unregisters a material target.
Declaration
public void UnregisterMaterialTarget(string materialId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | materialId | The identifier of the material target to unregister. |