• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by thomas 2 · Jul 15, 2010 at 01:32 PM · graphicsqualityvolumeoptionsmainmenu

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

Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image

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,

==

Comment
Bampf
Ricardo

People who like this

2 Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image thomas 2 · Jul 15, 2010 at 01:56 PM 0
Share

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

avatar image equalsequals · Jul 15, 2010 at 02:17 PM 0
Share

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

avatar image Cyclops · Jul 15, 2010 at 02:35 PM 0
Share

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

avatar image

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"?

Comment
Ricardo

People who like this

-1 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Graphics Settings for Builds Question 2 Answers

How would I code in a music/sound option? 0 Answers

Problem with sprite quality 1 Answer

Can't disable vSync (windows) 0 Answers

How to read QualitySettings without applying them from code? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges