So I’ve been fiddling with trying to make a random number in JavaScript. Using this code:
import System;
var date = DateTime.Now;
var shadowPercent;
function Update () {
shadowPercent = Random.Range(0,100);
Debug.Log("shadowRange= " + shadowPercent);
}
Attaching that to an object works perfectly fine.
If I then try to use this same script in a different JavaScript file it gives me:
BCE0004: Ambiguous reference ‘Random’: System.Random, UnityEngine.Random.
using:
var shadowPercent;
function TimeIntensity(){
var currentSeconds = date.TimeOfDay.Ticks / 10000000;
if(currentSeconds >= 21600 currentSeconds <= 32400){
GameLight.intensity = .02;
}
if(currentSeconds > 32400 currentSeconds <= 57600){
GameLight.intensity = .4;
}
if(currentSeconds > 54000 currentSeconds <= 68400){
GameLight.intensity = .2;
}
}
function Update(){
TimeIntensity();
shadowPercent = Random.Range(0,100);
}
Can anyone tell me why it is giving me this error?
EDIT: It seems to be coming from import System. When I remove this it doesn’t give me the ambiguous name anymore.
Does anyone have any solutions on how to use both of them.