I have a bullet script attached to my bullet controller and I thought I had it right, the bullet fires and spawns the prefabs but it does not move, I’m putting all of this into 2D and using c#. I have everything set in the scene that should be there but, the way I have velocity doesn’t seem to work for some reason? Any help appreciated.
void Fire()
{
// Create the Bullet from the Bullet Prefab
var bullet = (GameObject)Instantiate (
PlayerBullet,
bulletSpawn.position,
bulletSpawn.rotation);
bullet.GetComponent<Rigidbody2D>().velocity = bullet.transform.forward * 6;
// Destroy the bullet after 4 seconds
Destroy(bullet, 4.0f);
}