So, I 'm working on a game right now, improving my C# knowledge.I made a script that when you press spacebar, you will shoot a projectile.The script seems to work fine but when I press spacebar the projectile only goes forward for a split second, I have to tap spacebar in order to get it move forward.I heard about instantiate but I’m very confused.
Code:
//Press spacebar to shoot.
if(Input.GetKeyDown ("space")){
Instantiate(bulletPrefab, projectileSpeed, MyTransform.position.y);
}
}
}