Random.Range code problem or problem with Unity?

Hello, so I’m trying to have random waypoints generated with this code:

waypoint = waypoints[Random.Range(0, waypoints.Length)];

But I continously get the error ‘"GhostTeleport.Random()’ is a ‘method’, which is not valid in the given context" I then tried to just generate a random number to pass through as a point in the array but I still get this error. I’ve tried using a simple code like this as well:

int myRandomNumber = Random.Range(0, 1);

But I still get the error. Is this a problem with my code or is there another issue at play?

This code is in a script called GhostTeleport? You must have a method in your GhostTeleport script named Random. If you do, I would suggest renaming it.

If you don’t want to rename it, then you have to qualify your reference to Unity’s Random class…

int myRandomNumber = UnityEngine.Random.Range(0, 1);