I'm having a problem with Random.Range()

Hey Rick…

While i was trying to use ‘Random.Range()’, I need to write ‘UnityEngine.Random.Range()’, Whyyyyyyy???

1 Like

Welcome to the community!

This happens because of this two lines of code at the top of your script:

using System;
using UnityEngine;

Read the second paragraph, the one that starts with CS0104.

It says that is an ambiguos reference, that means that both System and UnityEngine have a class named Random, so you have o specify which one you are using (both do the same thing),

If you don’t want to specify you’ll either have to erase the “using System;” line or the “using UnityEgine;” line, but be careful, erasing any of this lines might cause some major issues within code, unless you know what you are doing, I recommend leaving your code as it is.

Thanks 4 the help :blush:

1 Like

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

Privacy & Terms