Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by dissidently · Mar 11, 2011 at 08:46 PM · controlsframeplaybackspritemanager2

Can SpriteManager 2 Animations be controlled like DVR playback?

Say I want, in code, pause the playback of a sprite animation at frame 11. Hold for a while, then rewind 3 frames, at a set frame rate, then pause again, then move forward 1 frame, pause... etc.. that sort of things. Is it possible in SpriteManager 2?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Goody! · Mar 20, 2011 at 09:42 PM 0
Share

You aren't going to get better answers than that. You should award the answer.

avatar image dissidently · Mar 21, 2011 at 08:03 AM 0
Share

wow. really. You're going to be the judge of that? the nerve.

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Goody! · Mar 15, 2011 at 10:44 PM

I believe so but you could ask Brady. anball@anbsoft.com

I use both SpriteManger2 and EZGui and highly recommended them.

Here's a relevant snippet from the documentation:

Playing Animations There are several ways to play animations on a sprite. You can play them by name, by index, or by reference. The fastest method is by reference, and a close second is by index. However, most of the examples you will find in this documentation will use the name method because it is easier to read and simpler to understand.

There are two main method categories which will play an animation: PlayAnim() and DoAnim(). The difference between these two is that PlayAnim(), anytime it is called, will re-start the animation at the first frame (or frame specified). DoAnim(), on the other hand, will only start an animation if that same animation is not already running. It is therefore a good idea to use DoAnim() in places where you just know that a certain animation ought to be running if it isn't already but don't want to have to check first. Use PlayAnim() in places where you know the animation should always start over, or start from a particular frame.

Both PlayAnim() and DoAnim() have versions which accept the animation's name, index, or reference as arguments. Some examples of these are shown below ("sprite" in the code below, is assumed to reference a Sprite or PackedSprite script).

// Play "walk" animation: sprite.PlayAnim("walk");

// Play "walk" animation if it isn't playing already: sprite.DoAnim("walk");

// Play the animation at index 3: sprite.PlayAnim(3);

// Play the animation referenced in the variable walkAnim: sprite.DoAnim(walkAnim);

In addition to these, the PackedSprite class also has versions of each which also accept an additional frame number argument. This second argument is the 0-based index of the desired frame on which the animation should start playing. Some examples: NOTE: These versions are only available on PackedSprites

// Play "walk" animation, starting at frame 3: sprite.PlayAnim("walk", 3);

// Play animation at index 2, starting with frame 1: sprite.DoAnim(2, 1);

// Play animation referenced by walkAnim, starting with frame 5: sprite.PlayAnim(walkAnim, 5); Stopping and Pausing

You may also stop and pause playback of an animation using the StopAnim() and PauseAnim() methods, and can unpause using UnpauseAnim():

// Pause playback of the current animation: sprite.PauseAnim();

// Resume playback: sprite.UnpauseAnim();

// Stop the animation entirely: sprite.StopAnim();

Posing You may have a sprite that instead of, or in addition to, using animation, it uses a series of "poses" depending on its state. An example would be an overhead view of an airplane that shows the airplane at various angles of banking depending on how steep the player is turning. For situations like this, you wouldn't want to play an animation but you can't get by with only one static frame either. In this situation you can use multiple, single-frame animations and simply "play" each animation that is needed for the particular pose. This will effectively change the frame being displayed. Alternatively, you can store the entire range of "poses" in a single animation, and simply play the animation starting at a specific frame, and then immediately pause the animation, like so:

// Frame 4 contains our desired "pose": sprite.PlayAnim("Poses", 4);

// Immediately pause here: sprite.PauseAnim();

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
2

Answer by Brady · Mar 16, 2011 at 08:58 PM

Yes. There is a version of PlayAnimInReverse() which accepts, as its second argument, the frame at which to start playing. So you can pause playback at any desired point, and then when you decide to go in reverse, can use PlayAnimInReverse() to start playing backwards at the frame where you paused.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Goody! · Mar 22, 2011 at 04:16 AM 0
Share

You should have got the points Brady. :) Thanks for the awesome products!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

How to slow down a game, or play it frame by frame 2 Answers

Is there a solution for adding video playback controls for all devices? 0 Answers

Input controls at run time reset to duplicate controls, why does this happen? 0 Answers

How to change controls in-game? 0 Answers

Can I control the movements of bones without animation. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges