Quizmaster list lecture question


so After setting up the get random question method my line containing:
int index = Random.Range(0, questions.Count); the Random turns green and red underline showing it as a Class and Im not sure why as Im pretty certain my code is identical.

Welcome to the community, @Oraphen

Random is a class, but there are two Random classes: one in UnityEngine and one in System. The code don’t know which one you want to use. You can fix this by changing it to UnityEngine.Random.Range(0, questions.Count). Another option is to check if System is needed (we usually start using System when we use Serializable) and if not, remove the using System line

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms