Hey there,
Does anyone know the magic word to add a rigid body as a component?
I’ve tried the following:
GameObject.AddComponent("RigidBody")
GameObject.AddComponent(RigidBody)
GameObject.AddComponent(rigidBody)
Nevermind I’m blind. Its “Rigidbody”, just like how the manual says
Posting incase someone runs into the same problem
spelling is a bitch aint it?
Of course, the right one was the only one you didn’t try
GameObject.AddComponent(Rigidbody);
(The reason is that “rigidbody” is a single word, but type names are always spelt with a capital letter in the API.)
none of that will work likely cause its not GameObject, its a reference to a valid game object existing in your game already. its no class instance function as which you try to call it there.
and if you use C# its typeof(Rigidbody) in the non-string case
none of that will work likely cause its not GameObject, its a reference to a valid game object existing in your game already. its no class instance function as which you try to call it there.
and if you use C# its typeof(Rigidbody) in the non-string case
Yes you’re right thanks. I think all of us here have already assumed that I was referring to an instance of a GameObject though.
haha i had same problem , thnx to this its solved i am kinda stupid too
So stupid you necro bumped a 3 year old thread! yay!
Hostility that you, I’m sorry to say, validated by needlessly bumping it another two years later. >_>;