Im trying to make a bullethell game and this is my code for the enemy shooting.
public void Shoot(GameObject myPrefab)
{
GameObject bullet = Instantiate(myPrefab, transform.position, transform.rotation);
Rigidbody2D rb = bullet.GetComponent();
rb.AddForce(transform.up * 5, ForceMode2D.Impulse);
}
}
But for some reason the bullets go a seemingly random speeds. Some will crawl across the screen where others will dash across in half a second. Help?
↧