using System.Collections; using System.Collections.Generic; using UnityEngine; public class Projectile : MonoBehaviour { public float speed = 60f; public Rigidbody2D rb; // Start is called before the first frame update void Start() { rb.velocity = transform.right * speed; } private void OnTriggerEnter2D(Collider2D collision) { Debug.Log(collision.name); Destroy(gameObject); } }