I'm using this script on a cube to detect out of bound colliding and alerting user:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class OutOfBounds : MonoBehaviour
{
public string message;
void Start(){
gameObject.GetComponent<Renderer>().enabled = false;
}
void OnCollisionEnter(Collision collision) {
if (collision.gameObject.tag == "Player") {
DialogueManager.ShowAlert(message);
}
}
}
This is working fine but its showing many alerts at once.
How can I make show just one alert for a while, like 2 seconds?
Use a timestamp.