I don’t know if it is because of deprecation between v.4 to 5 but following through the official unity video ‘shooting shots’: Shooting shots - 07 - Space Shooter - Unity Official Tutorials - YouTube - does not work.
Implementing the code allows the character to instantiate the shot object wherever they are, but it does not project, it just sits there.
Here is their code:
public GameObject shot;
public Transform shotSpawn;
public float fireRate;
private float nextFire;
if (Input.GetButton("Fire1") && Time.time > nextFire) {
nextFire = Time.time + fireRate;
Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
}
Hopefully this resource can get updated.
Thanks!