2D Toolkit Forum

2D Toolkit => Support => Topic started by: drkucho on January 12, 2015, 04:20:29 pm

Title: Bug when getting tk2dAnimator.CurrentFrame
Post by: drkucho on January 12, 2015, 04:20:29 pm
i think i found a bug cause if the animation is finished playing it returns frame+1 , in other words i have a one frame animation and it returns 1 instad of 0

greets
Title: Re: Bug when getting tk2dAnimator.CurrentFrame
Post by: unikronsoftware on January 13, 2015, 02:17:38 pm
It was kinda intended to signify the difference between "playing the last frame" and "finished playing the last frame". I can see how that could be a problem though, you can change the behaviour in

Code: [Select]
public int CurrentFrame {
get {
switch (currentClip.wrapMode) {
case tk2dSpriteAnimationClip.WrapMode.Once:
return Mathf.Min((int)clipTime, currentClip.frames.Length - 1); // change this

What does everyone else think? I can change this but dont want to break existing code.