Hello,
I’m new to scripting, so you’ll have to excuse what I imagine is a rather mundane problem. I have a script that controls the transparency of two objects with a gui slider, but I’d like to also control the mesh collider of those objects. What I’m thinking is I’d have to use an if statement with a Boolean variable based on if the slider is 1 or 0 but it seems no matter how I write it the result is the mesh collider is either always on or off. This is what I need to incorporate it in:
var slider1 : float=0;
var Object1: GameObject;
var Object2: GameObject;
function Start () {
slider1 = 1;
Object1 = GameObject.Find("top");
Object2 = GameObject.Find("bottom");
}
function OnGUI () {
slider1 = GUI.HorizontalSlider( Rect(50,650,500,50), slider1, 1, 0);
renderer.material.color.a = slider1;
}
function Update ()
{
selected.renderer.material.color.a = Object1;
sselected.renderer.material.color.a = Object2;
}
Thanks for any help.