Unbind a skinned mesh in Unity

Goal: Keeping a correctly skinned mesh after applying blend mesh operation.

I have read documentation on trying to use blend mesh with a model. Blend mesh operation changes the bone weights on a vertex. I have copied the current weights for each vertex and stored it. Now I want to unbind my mesh in unity so that I can resize the joints/bones. I will copy back these weights after I re-position the joints after the blend mesh operation.

Does Unity support unbinding and binding a mesh in real time or do I need to use an external plugin for doing this?

No, Unity doesn’t support such an operation out of the box. You would have to:

  • Bake the mesh manually
  • Calculate a new bindpose for each bone for the baked mesh
  • Use the baked mesh as new mesh and the current bone positions as new initial pose.

That’s just how it theoritically should work. It’s not that clear what the end result should look like. The bindposes docutmentation(linked already above) has a simple example how to create a skinned mesh procedurally.

If you only want to reposition the bones in the without affecting the mesh you might do:

  • create an exact copy of the bone hierarchy including the bones array of the SkinnedMeshRenderer.
  • Change the new bones the way you like.
  • When done recalculate the bindpose for the new bones and replace the bones array of the renderer.

From now on the mesh is using the new bones structure. However keep in mind that bone animations won’t work anymore since they just set the bones to certain absolute position / rotation values. If you change the positions of the bones, i.e. you create a new skeleton, bone animations are no longer compatible with the bone structure. You can still play them, but they would deform the mesh most likely in a way you did not intend. Of course if you know what you’re doing and you’re creating the animation procedurally for this configuration it might work. Best example of procedural animation adaption is the game Spore, but that was created by the most skilled procedural content developers on earth which where hired from the demoscene.

If you only want to reposition the bones in the without affecting the mesh you might do:

• create an exact copy of the bone hierarchy including the bones array of the SkinnedMeshRenderer.

DONT DO THIS !

Just parent the skinned mesh renderers root bone to its parent transform. You then don’t need to instantiate another set of game objects because the vertex weights are no longer being influenced.