I’m trying to get a bullet to go in the direction of a gun in 2 dimensions, but I’m finding it hard to pass in the variable to the prefab.
if(Input.GetKeyDown(KeyCode.Space))
{
iBullet = Instantiate(bullet, transform.position, Quaternion.identity);
iBullet.setDirection(gunRotation);
}
The Prefab, bullet, has a script that has the setDirection function within it. How do I call this?