playMaker

Author Topic: Animation not firing finished event when character out of camera view  (Read 3175 times)

noxqs

  • Playmaker Newbie
  • *
  • Posts: 7
Hi PlayMakers,

I found a weird but unwanted behavior.
Imagine a Dota (or Diablo) style game with a hero and monsters, all with animation.
During battle, I apply damage after a full attack animation cycle using the finish event in the play animation action. This way the damage is increased as the animation speed is increased.

This works fine if the characters are in camera view or if the scene camera and the scene window is open.
If the characters are not in camera view, the animation never finishes, never fires of the finished event and they never apply damage, never die and build up an immortal army which only seems to kill the framerate.
If during the game I move the camera back the animation cycles fire of the finish event again.

I have their animation wrap mode set to Once.

Any idea ?

4ppleseed

  • Full Member
  • ***
  • Posts: 226
Re: Animation not firing finished event when character out of camera view
« Reply #1 on: August 05, 2013, 11:01:06 AM »
I had some similar problems over here:

http://hutonggames.com/playmakerforum/index.php?topic=3825.msg17782#msg17782

''Unity includes the Scene View camera when checking visibility''

Maybe related to your problem?

noxqs

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Animation not firing finished event when character out of camera view
« Reply #2 on: August 05, 2013, 12:27:11 PM »
Hi dlmrky, thanks for replying.

It probably is related, maybe the animation actions only fires off the finished event if the gameobject is visible ?
Could anyone confirm this?

The only time finishEvent is set in the PlayAnimation action is at line 109:
Code: [Select]
if (!anim.enabled || (anim.wrapMode == WrapMode.ClampForever && anim.time > anim.length))
{
Fsm.Event(finishEvent);
Finish();
}
« Last Edit: August 05, 2013, 12:30:31 PM by noxqs »

MABManZ

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 125
    • MABManZ.com
Re: Animation not firing finished event when character out of camera view
« Reply #3 on: August 05, 2013, 02:52:41 PM »
On your object, change the Culling Type of the animation component to "Always Animate", it is set to "Based on Renderer" by default.