Our game keeps a pool of character ragdolls so we can have multiple copies of the 'dead' player persist in the game world. (Players die often, and it's a 6 player game)
Basically I have a Prefab apart from my actual playable character prefab that has a SkeletonRagdoll component on it and I call Apply() to activate the ragdoll, and later Reset() to clean it up. This is all working well..... but it is not very performant to be calling Apply() every death of the player as it has to run through every bone, call AddComponent a ton of times (Rigidbodies, Hinge Joints, etc).
With all that said, I'm trying to find a way that I can setup the Ragdoll just 1 time at game start and be able to reuse the ragdolls without needing to call Reset() and later Apply(). The issue is that I'm not sure how to approach "restoring" the ragdoll to a state that it will be ready to be used again for the next player death without using the existing Reset() method. I'd like to be able to simply move the ragdoll to a player death position, and apply a velocity to send it flying. (all the child rigidbodies of the ragdoll make this complicated)
I'm optimizing the game for Nintendo Switch and am seeing hiccups in performance when the ragdoll's Apply() method is run, so I'm trying to find a way around this.
Does anyone have any advice?