Random Range

I’m trying to get a sort of dice roll effect by using random range

var Dice : int = 0;

var DiceSound : AudioClip;







function OnMouseUp(){

Dice = (Random.Range(1, 3));

audio.clip = DiceSound;

audio.PlayOneShot(DiceSound);

}

But i keep getting this error no matter what I try
MissingMethodException: Method not found: 'Random.Range

Have you tried replacing it with “Random.RandomRange” instead?

its all correct about Random.Range(1,3)
remove extra () and will be ok… i think
like this Dice = Random.Range(1, 3);

My guess is that one of your scripts is named Random and it is getting them confused.

Either rename the offending script or use UnityEngine.Random.Range