Calling Rigidbody.AddForce on an Object? C#

I’m writing a program in c#, but I’m following a tutorial in javascript. I want a fireball to shoot out of my object, but it’s currently just spawning and not moving.

The tutorial JS code is:
fire.rigidbody.AddForce(transform.foward * 200);

I changed the above code so it should work in c#, but get the error: The Type UnityEngine.GameObject does not contain a definition for Rigidbody, and no extension method ‘Rigidbody’ of type UnityEngine.GameObject could be found.

So I then changed my code into this:
public Rigidbody rb;
rb = fire.GetComponent();
fire.rb.AddForce(transform.forward * 200);

But I get the same error.

This is written very poorly, but I have no idea how else to phrase it.

Code below:

using UnityEngine;
using System.Collections;

public class Pieman : MonoBehaviour{
	public float speed = 1f; float
	public float jumpHeight = 5f;
	public bool isFalling = false;
	// define what we're shooting
	public Transform newFireball;

	public GameObject fire;
	public Rigidbody rb;
	void Start () {
		transform.position = new Vector3(0, 2, 0);
		rb = fire.GetComponent<Rigidbody>();
	// Update is called once per frame
	void Update () {
		transform.Translate(Vector3.right * Input.GetAxis("Horizontal") * speed * Time.deltaTime);
		transform.Translate(Vector3.forward * Input.GetAxis("Vertical") * speed * Time.deltaTime);
		if(Input.GetKeyDown("space") && (isFalling == false)){
			transform.Translate(Vector3.up * jumpHeight * Time.deltaTime);
			isFalling = true;

		// check if we're shooting
		fire = Instantiate(newFireball, GameObject.Find("spawnPoint").transform.position, Quaternion.identity) as GameObject; 
		//fire.Rigidbody.AddForce(transform.forward * 5);
		fire.rb.AddForce(transform.forward * 200);
	void OnCollisionStay(){
		isFalling = false;

You can also do it like this

 GetComponent<Rigidbody>().velocity = transform.forward * Move_Speed;

You have to use “GetComponent”, but the generic version, the one where you can tell the method what kind of component you are looking for. Something like this should work:

fire = Instantiate(newFireball, GameObject.Find("spawnPoint").transform.position, Quaternion.identity) as GameObject; 
var rb = fire.GetComponent<Rigidbody>();
if(rb != null)
    rb.AddForce(transform.forward * 5);

A bit of info about the generic GetComponent method here.

your way of applying rigidbody on game object is not right
it should be like this

fire.rigidbody.AddForce(transform.forward * 500);

Visit the Link Below it tells the basics of how to use rigidbody properties
link text