- Home /
How to make a variable for color affect another object
static var Bslider : float; static var Yslider : float; static var Pslider : float; static var ShowSlider : System.Boolean; var PageClose : AudioClip;
function Start() { ShowSlider = false; }
function OnGUI () {
if(ShowSlider == false) return;
GUI.Box(Rect(1000,550,220,240),"Color Mix");
Bslider = GUI.HorizontalSlider(Rect(1020,650,175,30), Bslider, 0.0 ,1.0); renderer.material.color.r = Bslider;
Yslider = GUI.HorizontalSlider(Rect(1020,600,175,30), Yslider, 0.0 ,1.0); renderer.material.color.b = Yslider;
Pslider = GUI.HorizontalSlider(Rect(1020,700,175,30), Pslider, 0.0 ,1.0); renderer.material.color.g = Pslider;
GUI.Label(Rect(1050,580,175,30),"Yellow"); GUI.Label(Rect(1050,620,175,30),"Blue"); GUI.Label(Rect(1050,680,175,30),"Purple");
if(GUI.Button(Rect(1120,770,100,20),"Hide")) { GUI_ColorSlider.ShowSlider = false; audio.PlayOneShot(PageClose);
}
}
Here i have my script that changes the color of my character well some of it as there are different parts to my character how would i be able to let thesse sliders effect another game object please help thanx :)
Answer by qJake · Jun 28, 2010 at 11:22 PM
Read this page, which details exactly in what ways you can access other game objects:
http://unity3d.com/support/documentation/ScriptReference/index.Accessing_Other_Game_Objects.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613063345im_/https://answers.unity.com/themes/thub/images/avi.jpg)