- Home /
 
Missing a Method? Random.Range?
MissingMethodException: Method not found: 'UnityEngine.Random.Range'. Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher ()
 var speedMin;
 var speedMax;
 var radiusMin;
 var radiusMax;
 
 function Update () {
     direction = Random.onUnitSphere;
     direction.z = 0;
     
     var speed:int = Random.Range(speedMin, speedMax);
     var radius:float = Random.Range(radiusMin, radiusMax);
     
     centerPoint = direction * radius + transform.position;
 }
 
               [Edit by Berenger : Code formatting]
               Comment
              
 
               
              Try Random.RandomRange(speed$$anonymous$$in, Speed$$anonymous$$ax);
@Noran: no, look in the docs. It's Random.Range.
@chiggafoo: define your variable types. Also, format code when you post it.
Answer by SirMacJefferson · Apr 19, 2012 at 06:44 AM
It's because you didn't type your variables to ints or floats. Try this instead:
 var speedMin:float;
 var speedMax:float;
 
               Should make it work.
That's not why. The variables should be typed, but that's not actually relevant to the question, and the code works as-is.
Your answer