Hi,

Our animator made an animation where the character move in the X-axis, so it finish far from the root. When we play the animation in Unity an the root goes out of the screen, the mesh dissapear too. Before to say to our animator to make again the animation I want to ask if there's another way. (We are using 2DToolkit too)

Thank you

Related Discussions
...

Confirmed. This happens to some of my animations too, but strangely not all of them.
Particularly, it happens to some animations that only have one quad/image.

Without knowing the real cause, I can't really tell how to fix it on the runtime side.

15 days later

Could Unity be doing some kind of culling? What bounding box does it use for culling?

That's certainly my hunch. Can't say I understand the its criteria though.

But I do suspect it has something to do with the center of something going out of the screen. I dunno if it's the center of the bounding box, the center of the mesh or the center of the GameObject. Maybe you're right, maybe there is some sort of bounding box that needs to be forced to update (or can be manually set where it causes problems). I'll have to look into it sometime.

EDIT:
Did some very light looking-into it. I suspect it has something to do with incorrect frustum culling (I'm guessing OP was using a perspective camera too, like I am).
There's some talk of having to manually set the bounds property of the mesh? I guess that's the bounding box that Unity's frustum culling uses.

I'll look into it some more when I have some time to spare.

9 days later

We used this line

GetComponent<MeshFilter>().sharedMesh.RecalculateBounds();

to recalculate the mesh bounds on our Spine animation. it was being culled prematurely, as the animation deviated from the root quite a bit. We are also using TK2D.

Hope this helps!

6 days later

Unity is definitely thinking the mesh is offscreen so it doesn't need to be drawn.

Looks like we are using a MeshRenderer. MeshRenderer has bounds, but its read only.

Another option may be SkinnedMeshRenderer. It has a localBounds field that could be edited for a bigger "draw" zone.

SkinnedMeshRenderer.localBounds

var localBounds: Bounds;
Description
AABB of this Skinned Mesh in its local space.

It is precomputed on import for imported models based on animations associated with that model, which means that the bounding box might be much bigger than the mesh itself. It is recomputed every time when updateWhenOffscreen is enabled, but in this case it would be exactly the size of the mesh at that frame. See Also: updateWhenOffscreen.

I'm playing around now to see if it can be converted over

I think you only need to modify the bounds of the mesh. That's worked fine for me.

The bounds of the MeshRenderer may only be a property that returns the value of the bounds of the mesh it's holding. Not sure though.

Spine doesn't use SkinnedMeshRenderer. It builds and displaces vertices using its own system. It doesn't use Unity's built-in skinning system.

Note that SkeletonComponent renders using mesh double-buffering so there's two meshes you need to set the bounds of.

Pharan has it. SkinnedMesh is way more overhead than needed. The only catch with SkelComponent is to make sure you get both mesh1 and mesh2. I tried just editing the mesh associated with the MeshRendererererer but that gets overwritten on the first update.

	public void SetLocalBounds(Bounds boundage) {
		mesh1.bounds = boundage;
		mesh2.bounds = boundage;
	}

Also, if you are playing around with some of the proposed built-in collision additions, keep an eye on the SkelComp, I saw a bound update call in there.