Hello everyone. So I am really new to NGUI and I am trying to figure out how to change the material RGB with 3 ngui sliders (one for red, the second for green, and the third for blue). I have modified the code that I found on unity forums and made the color changing with normal unity gui. Here is the code.
#pragma strict
var Skin : GUISkin;
var myColorR : Color;
var myColorG : Color;
var myColorB : Color;
var myMaterial : Material;
var myColorRGB : Color;
function OnGUI () {
GUI.skin = Skin;
myColorR = RSlider (Rect (100,100,255,10), myColorR);
myColorG = GSlider(Rect (100,150,255,10), myColorG);
myColorB = BSlider (Rect (100,200,255,10), myColorB);
}
function RSlider (screenRect : Rect, rgb : Color) : Color {
rgb.r = GUI.HorizontalSlider (screenRect, rgb.r, 0.0, 1.0);
return rgb;
}
function GSlider (screenRect : Rect, rgb : Color) : Color {
rgb.g = GUI.HorizontalSlider (screenRect, rgb.g, 0.0, 1.0);
return rgb;
}
function BSlider (screenRect : Rect, rgb : Color) : Color {
rgb.b = GUI.HorizontalSlider (screenRect, rgb.b, 0.0, 1.0);
return rgb;
}
function Update () {
myColorRGB = myColorR + myColorG + myColorB;
myMaterial.color = myColorRGB;
}
How do I make this with NGUI sldiers? Thank you for your help and time.