Home

Published

- 1 min read

how to disable and enable rigidbody unity

img of how to disable and enable rigidbody unity

The solution for this is noted below

how to disable and enable rigidbody unity

Solution

   // if you want to disable the rigidbody on which the script is sitting on
// you can't do that but you can go around it by

// Just destroying the rigidbody by calling
Destroy(gameObject.GetComponent<Rigidbody>());

// and if you want it again call
gameObject.AddComponent<Rigidbody>();

// Remember "gameObject" with small 'g' reffers to the gameObj on which the script
// is sitting on

// -*-*-*-*-*-***-HAPPY CODING-***-*-*-*-*-*-

Try other methods by searching on the site. That is if this doesn’t work