Apperently after about a month of work on this game I have, I hit build and it says that I can’t use EditorGUIUtility.HSVToRGB. So now, a couple of scripts in my game don’t work. In the first script, HueShift, I use HSVToRGB() to shift the hue to many color. Pretty simple except now that I cant use HSVToRGB() I need a similar set of code that does the same thing. And in the second one, CoinCreate, I use HSVToRGB() to pick a random (Nice looking) color. Again, all I’m looking for is something that works exactly like HSVToRGB(). Thats it. Thanks!
HueShift:
#pragma strict
var h : float = 0.0;
function Start () {
}
function Update () {
gameObject.renderer.material.color = EditorGUIUtility.HSVToRGB(h, 1, 1);
if(h < 1){
h = h + 0.001;
} else {
h = 0;
}
}
CoinCreater (Look at lines 29-33):
#pragma strict
var xpos : float;
var spawnpoint : Vector3;
var coin : GameObject;
var rotation : Quaternion;
rotation.eulerAngles = new Vector3(0, 0, 0);
var newCoin : GameObject;
var rate : float = 3.0;
var fasterRate : float = 0.0;
var scriptEnabled : boolean = true;
function Start () {
Invoke("CreateCoin", rate);
}
function Update () {
}
function setRate(newRate : float){
rate = newRate;
}
function CreateCoin(){
fasterRate = 0.05;
xpos = Random.Range(-50.0,50.0);
spawnpoint = new Vector3(xpos, 80, 0);
var h : float = Random.Range(0.0,1.0);
if(scriptEnabled){
newCoin = Instantiate(coin, spawnpoint, rotation);
newCoin.renderer.material.color = EditorGUIUtility.HSVToRGB(h, 1, 1);
}
if(rate > 0.4){
rate = rate - fasterRate;
}
if(scriptEnabled){
Invoke("CreateCoin", rate);
}
}
function Unpause(){
yield WaitForSeconds(rate);
CreateCoin();
}