Comments and answers for "Is there a way to add a component to a rigidbody gameobject?"http://answers.unity.com/questions/1591492/is-there-a-way-to-add-a-component-to-a-rigidbody-g.html
The latest comments and answers for the question "Is there a way to add a component to a rigidbody gameobject?"Answer by cs120319992http://answers.unity.com/answers/1591502/view.html
What?
public class MyScript: Monobehaviour {
public GameObject myObject;
private Start() {
myObject.AddComponent<Rigidbody>();
myObject.GetComponent<Rigidbody>().simulated = false;
myObject.AddComponent<Other component>();
}
}Fri, 18 Jan 2019 13:32:39 GMTcs120319992Answer by hameed-ullah-janhttp://answers.unity.com/answers/1591499/view.html
You mean, you want to add rigidbody to a gameobject runtime? if yes then you can use the following code:
`GameObject myGameObject = new GameObject("Test Object"); // Make a new GO.
Rigidbody gameObjectsRigidBody = myGameObject.AddComponent(); `Fri, 18 Jan 2019 13:26:32 GMThameed-ullah-jan