NullReferenceExceptions on first call of Public Text text
I have checked the obvious spots I can think of but cannot seem to figure out where I’m messing up the references. Would like to ensure that I’m getting things right and not making silly mistakes as I move through the course.
Both Start & Game scenes have a NumberWizard script objects; in both scenes there are public text variables assigned to UI text objects.
####Expected Behaviour:
The UI text objects’ contents should be controlled by the NumberWizard script. No more, no less.
####Actual Behaviour:
The code throws error to console. Assets/Scripts/NumberWizard.css/NextGuess() line 77 on first call of a Public Text object.
The script does edit the UI text fields as desired, albeit with errors thrown to console.
Error persists in 4.7, 5.5 and 5.6 beta. (I’m only in 5.x so as to export WebGL)
Interestingly, in 5.6 beta I created two empty objects with the same names as the ‘missing’ objects from the script and pointed the NumberWizard Text object targets to them. No ensuing codes.
In the Start scene, the Text targets are tied into two UI text empties and no error is thrown.
In the Game scene, the Text targets are tied to two UI text fields and errors are thrown.
Any insights would be appreciated.
Ta.