Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
0
Question by JokerMartini · Jul 26, 2012 at 09:17 PM · menusettings

Menu and Difficulty setup

In the attached files is a very simple project setup which contains a ground plane and a prefab"Cube" The speed of the cube changes based on the level (easy, medium, or hard) chosen by the player. I was wondering how do I control the difficulty the player chooses to play.

Right now when the game is run the menu pops up as expected but the game starts playing in the background. I don't want the game to start until the player has chosen the difficulty. From there, based on the difficulty chosen it will change the value in the variable which controls the speed of the cube. I was wondering if someone could help me get this properly set up in its most simplest form. The menu and everything is already setup as well as the scene in the attached files.The player chooses the setting, then the menu disappears and the games starts with the variable set with the correct speed (see comments in attached file). That's what I'm looking for help on. I hope you guys can help.

Thanks Johnlink text

testinglevels_v01.zip (232.9 kB)
Comment
Add comment · Show 2
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 JokerMartini · Jul 27, 2012 at 01:31 PM 0
Share

Anyone able to help me out on this one?

avatar image AlucardJay · Jul 27, 2012 at 01:54 PM 0
Share

For not playing the game while in the menu, you could have everything waiting for the menu to be cleared by using a boolean, or have the menu in a separate scene, or you could freeze time.

Personally I would consider a boolean first (but you have to apply it to all scripts, or have all the scripts listen to wait for the bool to become true), next having a separate scene for the menu. Freezing time is more tricky, but I don't have much experience with this, suffice to say I know Update and OnGUI still run. And you don't want to put all your code in FixedUpdate, that is really meant to be used very $$anonymous$$imally, and only for physics based stuff. This can be tested with

 function Start () {
     Debug.Log("Start is Running");
 }

 function Update () {
     Debug.Log("Update is Running");
 
     if (Input.Get$$anonymous$$ouseButtonUp(0))
         Time.timeScale = 0.0;
 
     if (Input.Get$$anonymous$$ouseButtonUp(1))
         Time.timeScale = 1.0;
 }

 function FixedUpdate () {
     Debug.Log("FixedUpdate is Running");
 }

 function OnGUI () {
     Debug.Log("OnGUI is Running");
 }

For the difficulty, have the buttons return an int based on choice to set the cube with (reading back this part is working ok, yes?)

0 Replies

· Add your reply
  • Sort: 

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.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Save information on Level Load HELP 1 Answer

How do i add an extra menu to my main menu (I'm a Beginner programmer!) 1 Answer

Gather AudioSources in an Array? 1 Answer

adjust video settings in game 1 Answer

Trouble with writing text to a .ini file 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