Question Cannot reference the nonstatic field.

SageLife

New member
Joined
Jul 6, 2017
Messages
1
Programming Experience
Beginner
Hello, i am very new so thanks in advance for your patience, im sure there was a simple error made here. I've referred to google before coming here but it seems i wasn't able to make much of what i saw. the error im receiving is Assets/TextController.cs(11,28): error CS0236: A field initializer cannot reference the nonstatic field, method, or property `TextController.random' . Pic attached below. Thanks again guys.
 

Attachments

  • Test script.png
    Test script.png
    60.8 KB · Views: 47
int randomNumber = random.Next(0, 2);
'random' field is not available at this time, assign a value later.
 
Back
Top Bottom