Replace
Replaces the skeleton node that has the same identifier as a node.
Read time 3 minutesLast updated 4 hours ago
Definition
- Type: Method
- Namespace: Unity.Animations
- Assembly: UnityEngine.AnimationCoreModule
Replace(SkeletonNode)
Replaces the skeleton node that has the same identifier as a node.
public bool Replace(in SkeletonNode node)
Parameters
The node that replaces the node with the same SkeletonNode.Id.
Returns
Type | Description |
|---|---|
| bool | True if the builder had a node with the identifier. Otherwise, false, and the builder doesn't change. |
Remarks
The method keeps the index of the node, so the SkeletonNode.ParentIndex of the other nodes stays valid. The new node must follow the same rules as in RigBuilder.Add: its parent has a lower index, and only the node at index 0 is a root. To only change the default values of a bone, use RigBuilder.TrySetBoneDefaultTranslation, RigBuilder.TrySetBoneDefaultRotation, and RigBuilder.TrySetBoneDefaultScale.
Replace(LocalTranslationChannel)
Replaces the translation channel that has the same identifier as a channel.
public bool Replace(in LocalTranslationChannel channel)
Parameters
The channel that replaces the channel with the same identifier.
Returns
Type | Description |
|---|---|
| bool | True if the builder had a channel with the identifier. Otherwise, false, and the builder doesn't change. |
Remarks
Use this method to change a channel. The method doesn't change the bones. To change the default translation of a bone, use RigBuilder.TrySetBoneDefaultTranslation.
Replace(LocalRotationChannel)
Replaces the rotation channel that has the same identifier as a channel.
public bool Replace(in LocalRotationChannel channel)
Parameters
The channel that replaces the channel with the same identifier.
Returns
Type | Description |
|---|---|
| bool | True if the builder had a channel with the identifier. Otherwise, false, and the builder doesn't change. |
Remarks
Use this method to change a channel. The method doesn't change the bones. To change the default rotation of a bone, use RigBuilder.TrySetBoneDefaultRotation.
Replace(LocalScaleChannel)
Replaces the scale channel that has the same identifier as a channel.
public bool Replace(in LocalScaleChannel channel)
Parameters
The channel that replaces the channel with the same identifier.
Returns
Type | Description |
|---|---|
| bool | True if the builder had a channel with the identifier. Otherwise, false, and the builder doesn't change. |
Remarks
Use this method to change a channel. The method doesn't change the bones. To change the default scale of a bone, use RigBuilder.TrySetBoneDefaultScale.
Replace(FloatChannel)
Replaces the skeleton node that has the same identifier as a node.
public bool Replace(in FloatChannel channel)
Parameters
Returns
Type | Description |
|---|---|
| bool | True if the builder had a node with the identifier. Otherwise, false, and the builder doesn't change. |
Remarks
The method keeps the index of the node, so the SkeletonNode.ParentIndex of the other nodes stays valid. The new node must follow the same rules as in RigBuilder.Add: its parent has a lower index, and only the node at index 0 is a root. To only change the default values of a bone, use RigBuilder.TrySetBoneDefaultTranslation, RigBuilder.TrySetBoneDefaultRotation, and RigBuilder.TrySetBoneDefaultScale.
Replace(IntChannel)
Replaces the integer channel that has the same identifier as a channel.
public bool Replace(in IntChannel channel)
Parameters
The channel that replaces the channel with the same identifier.
Returns
Type | Description |
|---|---|
| bool | True if the builder had a channel with the identifier. Otherwise, false, and the builder doesn't change. |
Remarks
Use this method to change a channel.
Replace(EntityIdChannel)
Replaces the entity ID channel that has the same identifier as a channel.
public bool Replace(in EntityIdChannel channel)
Parameters
The channel that replaces the channel with the same identifier.
Returns
Type | Description |
|---|---|
| bool | True if the builder had a channel with the identifier. Otherwise, false, and the builder doesn't change. |
Remarks
Use this method to change a channel.