• Unity
  • [ BUG? ] Skeleton Mecanim - Update When Invisible

  • Изменено
Related Discussions
...

Hi Harald,

Skeleton Mecanim - Update When Invisible doesn't seem to work for me. Even when I set the Update When Invisible to Nothing, the animation still plays when off camera.

I did a test, please check the video. I added an animation event with a

print("riunn");

call. You can see even when the goblin is off camera, the print message is still being called via the console.

Is Update When Invisible functional or just a placeholder at the moment? :think:

The only way I could get the animator to stop playing was using Unity's own Animator Culling Mode. But I'm not sure if that's the best approach for Spine? :wounded:

Also unfortunately the above solution won't work when an animator component isn't present.

Thanks for your help 🙂

IndieDoroid написал

Skeleton Mecanim - Update When Invisible doesn't seem to work for me. Even when I set the Update When Invisible to Nothing, the animation still plays when off camera.

Events are issued by Mecanim itself, so you will always receive them regardless of the offscreen update mode. If you put a print statement into any of the animation methods, you will see that the animations are not evaluated.

Harald написал

Events are issued by Mecanim itself, so you will always receive them regardless of the offscreen update mode. If you put a print statement into any of the animation methods, you will see that the animations are not evaluated.

Hi Harald

Thanks for the response.

I might be confused. Please bear with me. 🙁

Referring to the Youtube movie.
@0:33


Frame 30, the event in the (Unity) animation tab isn't a spine event, it's just an event created via right clicking on the (Unity) animation timeline. Is that the event you're referring to above? That event has a method saying

print("riunn");

@0:54 The console still prints out "riunn" despite the goblin being out of view and "update when invisible" is set to nothing. Expected outcome would be a pause on the "riunn" counter.

@1:16 The animator controller is still looping the animation too. Expected outcome would be a paused animator controller.

Are these all supposed to occur when setting "update when invisible" to nothing?

Again I might be confused. Thanks for your help

IndieDoroid написал

Are these all supposed to occur when setting "update when invisible" to nothing?

Yes, they are supposed to occur, it only prevents applying Spine animations. It does not disable the Mecanim Animator component, which issues events.

We could change behaviour so that it also disables the Animator component in this setting (on the 4.0-beta branch, as 3.8 behaviour shall not be changed).

Harald написал

Yes, they are supposed to occur, it only prevents applying Spine animations. It does not disable the Mecanim Animator component, which issues events.

We could change behaviour so that it also disables the Animator component in this setting (on the 4.0-beta branch, as 3.8 behaviour shall not be changed).

Oooohh. I think I get it.

So is this the correct analysis?

When Spine assets are off screen.

  • Unity is still playing the animation states (which is why we still see the looping animation states @1:16 and the console event calls)
  • But Spine is NOT actually rotating, translating or scaling the artwork, IK, paths, bones or meshes.

Is that right? :bigeyed:

If possible, it could be a boolean to allow us to choose the required behaviour. Sometimes Mecanim Animator keeping issuing events is needed, sometimes not.

IndieDoroid написал

But Spine is NOT actually rotating, translating or scaling the artwork, IK, paths, bones or meshes.

Yes, but not limited to that. It is not applying the animations at all, so also no draw order changes are issued and so on. It's only the events which are issued, since these are no longer part of the Spine animations but have been handed over to the dummy animation that is processed by the Mecanim statemachine.

DarkTI написал

If possible, it could be a boolean to allow us to choose the required behaviour. Sometimes Mecanim Animator keeping issuing events is needed, sometimes not.

This would mean to disable the Animator component completely then, as it's the only way to avoid the events from being called. Would this suit your use-cases?

Harald написал

Yes, but not limited to that. It is not applying the animations at all, so also no draw order changes are issued and so on. It's only the events which are issued, since these are no longer part of the Spine animations but have been handed over to the dummy animation that is processed by the Mecanim statemachine.

Perfect! Thanks for the clarification! 🙂

Harald написал

This would mean to disable the Animator component completely then, as it's the only way to avoid the events from being called. Would this suit your use-cases?

Yes, of course 🙂