• 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
2
Question by frmusta · Apr 28, 2010 at 03:34 AM · animationrewind

Animation Rewind does not set object back to original state

Is this supposed to set the object like it is when on frame 0? i tried using this:

function rewindAllAnimation()
{
    for (var i : int = 0; i < gameObjectsToRewind.length; i++)
    {
          gameObjectsToRewind[i].transform.animation.Rewind();
    }
}

I was hoping that the objects im trying to rewind would return to their state before played animations. Is this the right way to go about doing this?

EDIT

I have noticed that if i call the rewind function WHILE the animation is playing, it resets it to its first frame, but continues to play to the end again. If i call this after it has completed animating it does nothing... WHAT AM I MISSING!? This seems like it should be so simple. Please point out my newbie mistake :)

Comment
Add comment
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

3 Replies

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

Answer by runevision · Apr 28, 2010 at 11:21 AM

Rewind() sets the time to 0. It does not do anything else. If a clip was playing, it will keep playing but from the beginning. If a clip was not playing, it will still not be playing (but it will start from time 0 next time you start it).

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
3

Answer by Jason_DB · Apr 28, 2010 at 10:29 AM

Well I think that if you called animation.Stop in the same place where you rewind it, then the animation wouldn't keep playing.

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
0

Answer by MaDDoX · May 16, 2010 at 03:02 PM

If you want to resume your animation later on, use animationState.speed = 0; To resume it, animationState.speed = 1;

BTW, it's a common mistake confusing animation (collection of animations) with animationState (the actual, individually named "clip"), make sure you're accessing the right one.

Good luck!

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

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Can I make animations snap to a frame? 2 Answers

Animation.Rewind() does nothing 1 Answer

Trouble with animation Rewind/stop 0 Answers

Need help with animation rewind 1 Answer

How to select an animation clip by index number? 7 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges