Hi,
Does the animation still work?
If not, check these things:
- The AnimatorPlay() command specifies the correct subject.
- The animator state name is correct.
- The subject has an Animator component with an animator controller that has that state name.
Internally, the AnimatorPlay() sequencer command calls the Animator component's Play() or CrossFadeInFixedTime() method.
You can specify a layer in your animator controller. For example, to specify a cross-fade of 0.3 seconds and layer 1:
Code: Select all
AnimatorPlay(Idle, speaker, 0.3, 1)
If you don't specify a layer, it defaults to layer '-1' which, to quote the
API: "If layer is -1, it plays the first state with the given state name or hash."
If there is no state with the name you specified, Unity will report that error.