//Jimmy Vegas Unity Tutorial //These scripts are for your subtitles using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class A001Spider : MonoBehaviour { public GameObject theSubs; public AudioSource spiderVoice; void OnTriggerEnter(Collider other) { StartCoroutine(SpiderSub()); this.GetComponent().enabled = false; } IEnumerator SpiderSub() { spiderVoice.Play(); theSubs.GetComponent().text = "Looks like there's some spiders over there."; yield return new WaitForSeconds(2); theSubs.GetComponent().text = ""; } } using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class A002Door : MonoBehaviour { public GameObject theSubs; public AudioSource doorVoice; void OnTriggerEnter(Collider other) { StartCoroutine(SpiderSub()); this.GetComponent().enabled = false; } IEnumerator SpiderSub() { doorVoice.Play(); theSubs.GetComponent().text = "I'll need a gun before I go in here."; yield return new WaitForSeconds(2); theSubs.GetComponent().text = ""; yield return new WaitForSeconds(3); this.GetComponent().enabled = true; } }