I have a 3D Text in my level with this script attached to it:
private var video = false;
var soundhover : AudioClip;
private var showGUI : boolean;
function Start ()
{
showGUI = false;
video = false;
}
function OnMouseEnter()
{
audio.PlayOneShot(soundhover);
}
function OnMouseUp()
{
showGUI = true;
}
function OnGUI()
{
if(showGUI)
{
(GUI.Button(Rect(Screen.width/2 - 50, Screen.height/2 + 30, 100, 30), "Video Settings"))
(GUI.Button(Rect(Screen.width/2 - 50, Screen.height/2 + 90, 100, 30), "Back"));
video = true;
}
}
if(GUI.Button(Rect(Screen.width/2 - 50, Screen.height/2 + 90, 100, 30), "Back"))
{
video = false;
}
if(video)
{
var qualities = QualitySettings.names;
GUILayout.BeginVertical ();
for (var i = 0; i < qualities.Length; i++){
if (GUI.Button(Rect(Screen.width/2 - 50, Screen.height/2 - 120 + i * 30, 100, 30), qualities[i])){
QualitySettings.SetQualityLevel (i, true);
}
}
GUILayout.EndVertical ();
if (GUI.Button(Rect(Screen.width/2 - 50, Screen.height/2 + 90, 100, 30), "Back")){
showGUI = false;
video = false;
}
}
I’m trying to make it to where if you hover over the “Options” 3D text’s collider, it makes a sound. When you click on it, it displays on screen GUI. I’m getting this error: