Export ragdoll setup to script

[Update:]
Finally I’ve created my own C# code generator as editor class and will provide it as open source the next days.


I have a fully rigged and animated character imported from Blender. I managed to convert it into a ragdoll, switching from kinematic rigidbody to ragdoll on death works fine. Almost perfect, but the ragdoll wizard obviusly leads to losing the prefab connection.

Now is there any clever trick or existing coder generator script to export all CharacterJoint, Collider and Rigidbody objects to C# code so that I can paste it into a ragdoll factory class. So all ragdoll related components are created dynamically at runtime.

The charm about this is that I can modify my Blender model without losing the ragdoll setup. Another scenario is to make a (disabled) copy of the statically ragdolled character and you can fine tune your ragdoll setup later on. So you just need to regenerate the code.

I started with an EditorUtility class but I guess it costs some hours - anybody out there with a working solution?

Thanks
Kay

I created a code generator for C# and released it as open source under MIT license. Further on I wrote an article in my blog where you can find the code as well:

C# Code Generator As Add-on for Unity3D Ragdoll Wizard

Update: The GitHub repo can be found here. But note that the code is very old and probably not working in newer Unity versions.