Unity Simple Animation Implementation

Source: Internet
Author: User

1: Create a Sprite Render (player) Animation object and add the script player, click the main Menu "window" →animation (animation window) Animation panel (select the object you want to animate) Click Create animation (named Idle) to save to a custom folder (Animation)

Select Add Sprite in 2:addproperty

3: Drag the Sprite to the appropriate frame position in the specified order. You can change the playback rate by samples

4: Add animations for various states (Create New Clip) such as: Run,jump,down

5: Open the animator, which contains all the animated states previously added

Any state, which is a pointer to an animation, can be toggled as long as the condition satisfies any status, such as Death animation.

Entry the animation to play in the starting state.

6: Add status Switch condition (Float,int,bool,trigger)

Example: You can add a variable named Isrun of type bool

7: Transitions between various animations (make Transition)

The idle state points to a transition in the run state

8: Click the arrow, the idle state can switch to the run state, you can add the status switch condition in the lower right corner isrun

9: When Isrun is true, switch from state idle to state run when Isrun is false by state run switch to state idle.

10: After the animation is set up, the animation can be toggled with simple script control

Note: Loop playback issues When you encounter any state jump status. The root cause is that any state contains its own status resulting in the jump status->jump state, so it loops when the condition is met. Cancel the can Transition to tick option.

Unity Simple Animation Implementation

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.