I’m trying to use the MeshMerger on the wiki to do some performance testing with drawcalls. The script appears to be working correctly but I’m left with a skinned mesh that is not being driven by the original transforms. If I go back to any of the original mesh’s renderer and re-enable one while the game is still playing, the whole skinned mesh beings to update. It seems to me that something in the pipeline is trying to optimize transform motions out as it doesn’t realize that it is driving the skinned meshes bones. I’m not sure if its Mecanim or Unity itself.
Has anyone else run into this? is there a work around?
For now I’m hacking the script to leave at least one mesh renderer on while I’m testing but it would be good to get to the bottom of this.
I just took a quick look at the MeshMerger and what is does is create its own skinned mesh renderer that uses bone transformation to position each sub mesh. So there is NO way to make this work with existing skinned meshes, and in fact you’ll pay skinning performance cost per frame. Unless you actually want the ability to move each mesh around with the bone transformation I would say this is a very bad idea.
But I do believe you could make it work, but it would take a bit of work from you. You would need to preserve the bones and weights from the submeshes.
Yeah, our characters are made up of a bunch of unskinned meshes. The motion is driven at the transform level anyways. We are using this script to combine them into a single skinned mesh so that when we do real time shadows we don’t get a draw call for each mesh. The original transform are used as bones in the skinned mesh.
The problem is that mecanim is not updating the original transforms when no mesh renderer is active. I wonder if an “Update When Offscreen” option could be exposed on the animator to force a refresh on the transform. I’m just grasping at straws right now.
No sure if it’s the same situation, but take a look at the “Culling mode” on Animator component. If you’re getting movement offset but no animation, that might be the case, as simply unchecking and cheking it again forces to update bounding box Hope it helps!