x


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);
}
more ▼

asked Jul 15 '10 at 01:32 PM

thomas 2 gravatar image

thomas 2
11 2 2 3

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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,

==

more ▼

answered Jul 15 '10 at 01:47 PM

equalsequals gravatar image

equalsequals
4.5k 16 28 64

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!!

Jul 15 '10 at 01:56 PM thomas 2

I won't write your code for you, no, but I will give you an example to build off of.

Jul 15 '10 at 02:17 PM equalsequals

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 instead. 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

Jul 15 '10 at 02:35 PM Cyclops
(comments are locked)
10|3000 characters needed characters left

Well, do you have a camera in that scene that would be looking at the Options "menu"?

more ▼

answered Aug 12 '10 at 08:57 PM

john 2 gravatar image

john 2
75 29 35 46

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x504
x131
x78
x49
x38

asked: Jul 15 '10 at 01:32 PM

Seen: 886 times

Last Updated: Jul 15 '10 at 01:55 PM