Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Keep getting this error on different Text boxes. Any help would be appreciated!

$
0
0
NullReferenceException: Object reference not set to an instance of an object textHolder+c__Iterator1.MoveNext () (at Assets/Script/textHolder.cs:27) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) textHolder:Start() (at Assets/Script/textHolder.cs:19) The code: using UnityEngine; using System.Collections; using UnityEngine.UI; public class textHolder : MonoBehaviour { public string talking; private TextManager TMan; public float speed = 0.1f; //public string fullText; //private string currentText = ""; public string[] talkingLines; // Use this for initialization void Start () { TMan = FindObjectOfType (); StartCoroutine(ShowText()); } IEnumerator ShowText(){ for (int i = 0; i < talkingLines.Length; i++) { talking = talkingLines[i]; this.GetComponent ().text = talking; yield return new WaitForSeconds (1); } } // Update is called once per framea void Update () { } void OnTriggerStay2D (Collider2D other) { if (other.gameObject.name == "Player") { if (Input.GetKeyUp (KeyCode.Space)) { //TMan.ShowBox (talking); if (!TMan.talkingActive) { TMan.talkingLines = talkingLines; TMan.currentLine = 0; TMan.showTalking (); } } } } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>