using System.Collections; using System.Collections.Generic; using UnityEngine; public class Barrier : MonoBehaviour { private PlayerController player; private void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>(); } private void OnCollisionEnter(Collision collision) { if(collision.gameObject.tag == "Box") { Destroy(gameObject); } } }