How to use AddForce() on an Instantiated prefab?

I am instantatiating a projectile prefab using this code:

Instantiate (arrow, bow.transform.position, this.transform.rotation);

However, when I use:

arrow.rigidbody2D.AddForce (thisproj.transform.forward * shootforce);

It doesn’t work. I figured it’s because Unity thinks I am adding force to the actual prefab and not the clone so I tried doing this:

protected GameObject thisproj;
	thisproj = Instantiate (arrow, bow.transform.position, this.transform.rotation);

and then :

thisproj.rigidbody2D.AddForce (thisproj.transform.forward * shootforce);

however apparently, Instantiate() returns an Object not GameObject. But, I can’t figure out how to use AddForce() on an Object or get Instantiate() to return a GameObject.

Thank You!

Just cast it:

 GameObject thisproj = Instantiate (arrow, bow.transform.position, this.transform.rotation) as GameObject;
 thisproj.rigidbody2D.AddForce (thisproj.transform.forward * shootforce);

Note using ‘thisproj.transform.forward’ is not often found in 2D games. If ‘arrow’ is a sprite, you likely want ‘thisproj.transform.right’ or possibly ‘thisproj.transform.up’.