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!