Buenas. Estoy intentando que al colisionar mi player con un objeto aparezca un mensaje durante 3 segundos y luego desaparezca, pero no desaparece. Este es el código que he puesto. Agradezco vuestras sugerencias. Gracias. using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Mensaje5puntos : MonoBehaviour {
public GameObject ventana;
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player") {
ventana.SetActive (true);
StartCoroutine ("mensaje");
}
}
IEnumerator mensaje()
{
yield return new WaitForSeconds (3);
ventana.SetActive( false );
}
}
using System.Collections;
using UnityEngine.UI;
public class Mensaje5puntos : MonoBehaviour {
public GameObject ventana;
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player") {
ventana.SetActive (true);
StartCoroutine ("mensaje");
}
}
IEnumerator mensaje()
{
yield return new WaitForSeconds (3);
ventana.SetActive( false );
}
}