Hello Everyone,
I’m trying to make some arrows in order to show the parts of my 3d object. When I press the button to enable and show my arrows they become visible in white.
But I want to change the color to red when my mouse is over of certain button.
Now I can enabled and vanish my arrows and change the color to red from white, when the mouse cursor is over the button or Rect area assigned to change the color.
But when the cursor is outside of the Rect assigned to change the color. The color white is not back again.
Any advice is more than welcome!
Please take a look to this little short video.
Please take a look to my Script.
private var alpha: float = 1; // alpha starts at 1
private var vanish = false;
var fadeSpeed : float = 7.5;
function Update(){
if(vanish){
renderer.material.color.a = Mathf.Lerp(renderer.material.color.a, 1, Time.deltaTime * fadeSpeed);
} else {
renderer.material.color.a = Mathf.Lerp(renderer.material.color.a, 0, Time.deltaTime * fadeSpeed);
}
if(guiNew .alphaGo == 1){
t01();
guiNew . alphaGo = 0;
}
if(guiNew .alphaGo == 2){
t02();
guiNew . alphaGo = 0;
}
if(Input.mousePosition.x>890&&Input.mousePosition.y>385&&Input.mousePosition.x<890+60&&Input.mousePosition.y<385+42){
renderer.material.color = Color.red;
}
}
/////////////////////////////////////////
function t01(){
vanish = true;
}
function t02(){
vanish = false;
}