The return type of Instantiate
is a Transform
and cannot be casted directly to GameObject
(as GameObject
)
Your code should be:
void Shoot() {
Transform bullet;
bullet = Instantiate(bulletPrefab,
transform.Find("BulletSpawn").position,
transform.Find("BulletSpawn").rotation);
bullet.rigidbody.AddForce(transform.forward * bulletSpeed);
}