Enemy ragdoll death

Can anybody please send the C# script which makes enemy performs ragdoll on death but now Iam using only Destroy (GameObject); function can anybody help me with the ragdoll death script (iam new to unity) .

RAGDOLL PHYSICS in Unity!

@vaibhavrawath
If you want a script that makes the enemy a ragdoll when he dies so I think this would help

    [SerializeField] private GameObject enemyRagdoll;
    //This is just an example take whatever name you want

    void WhenEnemyDie() 
    {
            //I think you have a die system so I will just show you the code for ragdoll
            Instantiate(enemyRagdoll, transform.position, transform.rotation);
            Destroy(gameobject, 1f);
    }

Here are a few things you need to keep in mind

  • First, on the enemy don’t make the Ragdoll just duplicate the enemy and rename it to something like EnemyRagdoll or whatever you want then turn the ragdoll into a prefab and then drag the prefab from the project view into the variable slot.

There you go when enemy dies and that method is called he will be a ragdoll.
I hope this would make the Enemy a Ragdoll haha :wink: