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

Keep Getting NullReferenceException: Object reference not set to an instance of an object

$
0
0
this is super annoying and I cant seem to understand why im getting it, someone explain it please? Heres the line that gives me the error; txtDate.text = DateNumber.ToString("0"); and heres the whole script; using UnityEngine; using System.Collections; using UnityEngine.UI; public class CalanderScript : MonoBehaviour { public Text txtDate; private float DateNumber; public int CapValue; public int TimeValue; void Start () { txtDate = GetComponent(); DateNumber = 1; } // Update is called once per frame void Update() { DateNumber += Time.deltaTime / TimeValue; txtDate.text = DateNumber.ToString("0"); if (DateNumber >= CapValue) { DateNumber = 1; } } }

Viewing all articles
Browse latest Browse all 7934

Trending Articles



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