Hello Unity community,
I’m kind new with scripting and I’m trying to make a slider to shade or brighten the light.
I have a script for shading the light and another to do a slider but I can’t manage to combine the 2 of them. An idea?
Here is the script for the light shading:
light.intensity = 0.85;
function Update(){
if(Input.GetKeyDown(“f”)){
gameObject.light.intensity += 0.1;
}
if(Input.GetKeyDown(“c”)){
gameObject.light.intensity -= 0.1;
}
}
Here is the script for the slider:
var hSliderValue : float=0.0;
light.intensity = 0.85;
function OnGUI(){
hSliderValue = GUI.HorizontalSlider (Rect(25,25,100,30), hSliderValue, 0.0,8.0);
}
Thanks in advance!