Hi guys… I am trying to freeze the scene when my player hits certain objects and a gui window pops up. I tried to use a coroutine to do that but it seems like i don’t get the result I want. Any help?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Gui2 : MonoBehaviour {
[Serializefield] private GameObject customText;
IEnumerator OnTriggerEnter(Collider other)
{
if(other.CompareTag("Player"))
{
customText.SetActive (true);
Time.timeScale = 0.0f;
yield return new WaitForSeconds(3.5f);
customText.SetActive(false);
Time.timeScale= 1.0f;
}
}
}