Unity Statemachinebehaviour life cycle

Source: Internet
Author: User

Today we have studied the next animation state opportunity to a problem. There is an animation I just want to play with him once, but in some circumstances I need to let him play again.

There are probably two ways to do this:

1. Use Animatior Parameters that's usually the case.

2. Create a statemachinebehaviour for the animation node, which has a life cycle when the animation is finished, in which you can determine whether to jump or continue to play repeatedly

Let's look at the life cycle of Statemachinebehaviour:

usingUnityengine;usingSystem.Collections; Public classD:statemachinebehaviour {//for the time being, just list some of these common//when the animation enters play     Public Override voidOnstateenter (Animator Animator, Animatorstateinfo StateInfo,intLayerindex) {        Base.    Onstateenter (animator, StateInfo, Layerindex); }    //when the animation has finished playing     Public Override voidOnstateexit (Animator Animator, Animatorstateinfo StateInfo,intLayerindex) {        Base.    Onstateexit (animator, StateInfo, Layerindex); }    //Refresh animation every frame call     Public Override voidOnstateupdate (Animator Animator, Animatorstateinfo StateInfo,intLayerindex) {        Base.    Onstateupdate (animator, StateInfo, Layerindex); }    }

Unity Statemachinebehaviour life cycle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.