GetCompent() adds a Rigidbody

If I call GetCompent() a rigidbody is added. How do I check if the game object has a rigidbody? I do not want to add one.

if(GetComponent()!=null)

should do it IF the script is on the object you are checking for a rigidbody. if you are checking a game object other than the one you are running the script on it would be more like

if(Target.GetComponent<Rigidbody>()!=null)

where Target is a predefined gameobject.

using this script

	this.gameObject.AddComponent<Rigidbody>();