Create skinned mesh that uses existing bones

I’m trying to add custom clothing to a skinned character through script so it uses the original meshes bones instead of it’s own duplicated ones.

I have a character that I’ve rigged and animated. I also have some extra clothing that is rigged to the same skeleton and exported separately, but when I instantiate it in game at run time, I’d like to optimize it so it uses the characters skeleton instead of it’s own.

Any pointers on how to go about this or perhaps a tutorial I’ve missed?

The only reference I have is the example in their code:

https://docs.unity3d.com/2017.2/Documentation/ScriptReference/Mesh-bindposes.html

Despite me reporting it for several years now, the triangles are still wound backwards so the above example when dropped into a blank scene will show absolutely nothing to the default camera. :facepalm:

To fix, replace the triangle array allocation with:

// wind the triangles to face the default camera FFS
mesh.triangles = new int[] { 0, 2, 1, 1, 2, 3 };

Thanks for the tip.
I just managed to get clothing working on an animated mesh thanks to this older post;

https://discussions.unity.com/t/667297 ?fbclid=IwAR16SZzmfNOqBzsUQ8ISg1fnlQUrvLZ_eTL08jqKmbI5n74aGoXwJY5YboA

but I plan to combine the meshes at some point to reduce the number of SkinnedMeshRenderer’s in the scene.