I have this script that kills object , but I want the object to die only if touching the ground for 3 seconds or more. please help
using UnityEngine;
using System.Collections;
public class die : MonoBehaviour {
void OnCollisionEnter2D(Collision2D coll) {
if (coll.gameObject.CompareTag ("Ground")) {
Destroy (gameObject, 3);
}
}
}