using UnityEngine; public class Shooter : MonoBehaviour { public GameObject projectilePrefab; public float shootPower = 10f; public void Shoot(Vector2 dir) { GameObject proj = Instantiate( projectilePrefab, transform.position, Quaternion.identity ); Rigidbody2D rb = proj.GetComponent(); rb.linearVelocity = dir * shootPower; } }