Hello Guest

Author Topic: Animation event not fired sometimes  (Read 6598 times)

Metik

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Animation event not fired sometimes
« on: May 31, 2013, 12:42:03 pm »
Hi,

I observed a strange behavior that sometimes animation event (trigger) is not fired. I'm using Unity 4.1.3f3 and Tookit2d 1.92 + patch1.
My guess is that it is not fired if the preceding or maybe following animation frame is skipped due to framerate drop(for example).
Is it a valid diagnosis?
If so then shouldn't 2dToolkit fire all the events from skipped frames if framerate drop happens?
I have a characters in my game that have some long attack animations where at some particular frame a bullet is fired and the animation continues. Unfortunately sometimes animation event is not triggered and my bullet is not fired. This behavior forces me to split animation into parts because animation end event is always fired. This is highly inconvenient beacuse I have many animations to split.

Thanks in advance!

TekuStudios

  • 2D Toolkit
  • Full Member
  • *
  • Posts: 177
    • View Profile
    • Teku Studios
Re: Animation event not fired sometimes
« Reply #1 on: May 31, 2013, 01:02:09 pm »
Try some things.

· Do you have some kind of flag in your code? e.g. There's some bool check in your event code that prevents the flow from entering there if certain conditions are met.
· Are you looping the entire animation? e.g. If you are using "Loop section", make sure that the event keyframe is located within the looped section.

So far we haven't experienced any trouble with animation events. In fact, we use them a lot, and the main character alone has more than 50 animations.
We are an Indie videogame developer located in Teruel, Spain. A small 6-people team which is currently working on the upcoming 'Candle'.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Animation event not fired sometimes
« Reply #2 on: May 31, 2013, 02:30:21 pm »
tk2d should fire all events, regardless of skipped frames. The only situation I am aware of where it will miss events, is if it loops over the animation 2x in one frame. Only one set of events will be fired there.

Metik

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Animation event not fired sometimes
« Reply #3 on: June 01, 2013, 01:07:37 am »
Thank you all for the responses. You helped me to find the reason and I'm going to send a followup message to Unikron.