i’m trying to get the death of a gameobject to intervene after it is out of the camera view the destroy function works fine but not the waitforseconds!
using UnityEngine;
using System.Collections;
public class score : MonoBehaviour {
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Player")) {
Destroy(gameObject, 3f); // destroy after 3 seconds
}
}
}
Next time, copy-paste the code and format it with the 101/010 button.