Addforce after Instantiate

I have a rectangle with a script on it.

public Rigidbody rgb;

void Start()
{
}

void OnCollisionEnter (Collision collision)
{
	Vector3 contactPoint = transform.InverseTransformPoint (collision.contacts[0].point);

	if ((contactPoint.x > -0.2f) && (contactPoint.x < 0.2f))
	{
		rgb.AddForce (transform.up * 400);
	
	}
	else
	{
		rgb.AddForce (transform.up * 250);
	}
}

}

I create spheres using “Instantiate” every 4 seconds ,and they fall on the top of rectangle , and “Addforce” should create the bounce effect. The sphere is a prefab. In the script im using prefab’s Rigidbody .

The problem is that , everytime when “Instantiate” creates a sphere, the script on my rectangle does not see the rigidbody of it .

Please help me to figure out , how can i make the script see the rigidbody of the cloned sphere.
Thank you in advance !

Try getting the sphere’s rigidbody like this then applying the force.

Rigidbody rb = collision.gameObject.GetComponent<Rigidbody>();
rb.AddForce (transform.up * 400);

Rigidbody mySphere; //Not Gameobject mySphere. This is the container for your prefab.


    Rigidbody rb = Instantiate(GUBBINGS) as Rigidbody;
    
    rb.AddForce(x,y,z);