updateWhenOffscreen/cullingType = AnimationCullingType.AlwaysAnimate not working

Hey there,

I have a skinned character mesh. In one of the animations, the character walks out of the screen. The animation is done in a way, that the character walk out of its origin. The animation of the caracter pauses, if he walked out of the screen. But I want the animation to continue, because that gamelogic waits for it. I have the following code:

//1
foreach ( SkinnedMeshRenderer r in skaterModel.GetComponentsInChildren<SkinnedMeshRenderer>() )
	r.updateWhenOffscreen = true;
		
//2
foreach ( Animation a in skaterModel.GetComponentsInChildren<Animation>() )
	a.cullingType = AnimationCullingType.AlwaysAnimate;

The problem now is:
When I only have block //1 active the character does NOT get animated if it disappears from the screen.
When I have block //1 and //2 active, the character is not animated at all, no matter which animation I play.

Can anyone explain to me, which part of updateWhenOffscreen and AlwaysAnimate I did not understand?
Does anyone another solution to this kind of problem?

Thanks and best regards
– Benjamin Schulz

I've experienced something very similar. My solution was to disable and enable the Animation component just after setting the cullingType. It seems like a bug to me, but this fixed my issue for now.

3 Answers

3

Yes I’m seeing something similar to you. I think it’s a bug in unity to be honest.

yes I’m definitely seeing something similar to you. I have a suspicion chaining cullingType at runtime resets some other states. I’ve noticed on the animating character if I change it back to BasedOnRenders briefly at runtime and then back to AlwaysAnimation it seems to work as expected. Not sure how to solve this problem definitely yet however.

For someone who suffers similar problem. If you have not so many characters and do not need to cull animation, just check “Always Animate” box in Inspector.

[42867-스크린샷-2015-03-19-오전-114618.png|42867]