- Home /
i have this script as option script but i cant see it
Hi.I am new here and i have a question. I have a Main Menu and 3 buttons.Start Game,How to play and Options. I want when i press the button Options to go to another scene that is attached the script below.
My problem is that when i press the Options button i go to the scene but i cant see anything. Can someone fix it? I think its easy but i dont know how..
thanks
Here is the script!
With that script i can change the volume and the graphics of the level.
var skin:GUISkin;
function Qualities() {
switch (QualitySettings.currentLevel) {
case QualityLevel.Fastest:
GUILayout.Label("Fastest");
break;
case QualityLevel.Fast:
GUILayout.Label("Fast");
break;
case QualityLevel.Simple:
GUILayout.Label("Simple");
break;
case QualityLevel.Good:
GUILayout.Label("Good");
break;
case QualityLevel.Beautiful:
GUILayout.Label("Beautiful");
break;
case QualityLevel.Fantastic:
GUILayout.Label("Fantastic");
break;
}
}
function QualityControl() { GUILayout.BeginHorizontal(); if (GUILayout.Button("Decrease")) { QualitySettings.DecreaseLevel(); } if (GUILayout.Button("Increase")) { QualitySettings.IncreaseLevel(); } GUILayout.EndHorizontal(); }
function VolumeControl() { GUILayout.Label("Volume"); AudioListener.volume = GUILayout.HorizontalSlider(AudioListener.volume,0.0,1.0); }
Answer by equalsequals · Jul 15, 2010 at 01:47 PM
Try nesting all your calls to GUI classes in the function OnGUI()
The problem is that you have no entry to the scripts to draw anything.
Edit:
function OnGUI(){
if(GUI.Button(new Rect(100,100,100,100), "my button"))
{
print("you pressed the button");
}
}
If that is applied to a game object, you should see a button drawn at 100,100.
Cheers,
==
ah please if its easy can you do it for me because i dont understand. Where to put that the OnGui(). Do i have to put a print in the code to show all of this?
Please help!!
I won't write your code for you, no, but I will give you an example to build off of.
OnGui() goes into any script that's attached to a GameObject. And he put a print only for demonstration purposes, you would put your game code there ins$$anonymous$$d. Finally, I highly recommend you run through some tutorials: http://answers.unity3d.com/questions/4897/how-can-i-start-learning-unity-fast-list-of-tutorials
Answer by john 2 · Aug 12, 2010 at 08:57 PM
Well, do you have a camera in that scene that would be looking at the Options "menu"?