using System.Collections; using System.Collections.Generic; using UnityEngine; public class Gun : MonoBehaviour { public GameObject bulletprefab; public Transform firePoint; public float fireForce = 10f; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void Fire() { GameObject bullet = Instantiate(bulletprefab, firePoint.position, firePoint.rotation); bullet.GetComponent().AddForce(firePoint.up * fireForce, ForceMode2D.Impulse); } }