using System.Collections; using System.Collections.Generic; using UnityEngine; public class CubeClash_Water : MonoBehaviour { private void OnTriggerEnter(Collider other) { if(other.GetComponent() != null) { StartCoroutine(Destroyer(other.gameObject)); } } IEnumerator Destroyer(GameObject obj) { yield return new WaitForSeconds(1); Debug.Log("Destroying: "+obj.name); Destroy(obj); } }