Quantcast
Channel: Answers by "Graham-Dunnett"
Viewing all articles
Browse latest Browse all 959

Answer by Graham Dunnett

$
0
0
I guess you just don't understand what `NullReferenceException` means. So, if a variable isn't set to an object, then you need to do a simple piece of code: void DoChop() { if (remainSlider) { if (remainSlider.value != 0) { timer = 0f; canChop = false; remainSlider.value--; remainingText.text = remainSlider.value.ToString(); } } else { Debug.Log("something has gone wrong"); } } This will use the debug log to tell you that `remainSlider` isn't set. Now, also, you claim that every object has had `remainSlider` set correctly. So it would be trivial for you to check that this variable is set in the `Start()` function.

Viewing all articles
Browse latest Browse all 959

Trending Articles



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