2D Toolkit Forum

2D Toolkit => Support => Topic started by: test84 on March 31, 2014, 01:36:43 pm

Title: Not sure if it's a bug or design decision.
Post by: test84 on March 31, 2014, 01:36:43 pm
Hi,

I wanted to change animation of one of my sprite animators via calling "Play("myClipName")" upon it but it was not successful and animation wouldn't change. Then I realized that I checked "Play automatically" in editor for that sprite animator and once I de-checked it, it was working. So in another way, that check box was forcing the initial animation in animation changes in the future. I tested this in both 2.3.3 and 2.4.0 and was suspecting it might be a bug since this behavior seemed strange to me.

Let me ask a question as well, is there any way to call an animation and force it to restart it if it's already playing back?

Thanks.
Title: Re: Not sure if it's a bug or design decision.
Post by: unikronsoftware on March 31, 2014, 07:18:09 pm
Its a design decision.
You can use PlayFromFrame("", 0) to restart it.
Title: Re: Not sure if it's a bug or design decision.
Post by: test84 on April 01, 2014, 11:10:24 am
Wish it would throw a warning or been mentioned in the docs as I found the solution totally by accident.
Title: Re: Not sure if it's a bug or design decision.
Post by: unikronsoftware on April 01, 2014, 02:07:27 pm
It sure is mentioned in the docs. "Will not restart the clip if it is already playing."
http://2dtoolkit.com/docs/2.4/html/classtk2d_sprite_animator.html
Title: Re: Not sure if it's a bug or design decision.
Post by: test84 on April 01, 2014, 02:33:23 pm
It sure is mentioned in the docs. "Will not restart the clip if it is already playing."
http://2dtoolkit.com/docs/2.4/html/classtk2d_sprite_animator.html

I actually meant the other thing, play automatically persistently forcing itself on change of clip.
Title: Re: Not sure if it's a bug or design decision.
Post by: unikronsoftware on April 01, 2014, 03:08:14 pm
I dont understand that one - play automatically does nothing different to you calling Play on start. In fact, thats all it does...
Title: Re: Not sure if it's a bug or design decision.
Post by: test84 on April 01, 2014, 09:36:21 pm
I dont understand that one - play automatically does nothing different to you calling Play on start. In fact, thats all it does...

That's what I described in first paragraph of my first post, apparently I wasn't clear enough. When I tick the check box to play automatically an animation, I can't change it later with calling Play on the animator.
Title: Re: Not sure if it's a bug or design decision.
Post by: unikronsoftware on April 01, 2014, 11:15:05 pm
"Let me ask a question as well, is there any way to call an animation and force it to restart it if it's already playing back?"

I was answering that question. If you call Play on a clip that is already playing by whatever means, its not going to restart it. Ticking "Play Automatically" is no differently to calling Play on Start.