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 Derek 1 · Apr 07, 2011 at 11:52 PM · audiopauseattack

Pause Menu Problems

I am having issues with my pause menu. I have two scripts that make it work. One is the UpdateScript and the other is the PauseMenuScript. Everything is working fine with script except for the audio. I have tried adding a few things but nothing is working. I am sure its an easy fix, but I can't figure it out. I want the background music to stay on, but all other sounds (like CopperActiveLoop) to turn off. Both of the scripts below are added to a camera called PauseMenuCamera.

Since I don't want to post another question, my other issue with the pause menu, is once you click "Resume" the character does a punch since left clicking is the command to punch. Is there something I can add to this code, or the playercontrol code to stop him from punching only when resume is clicked?

UpdateScript:

function Update () {

if(Input.GetKey("p")) { Time.timeScale = 0; var script3 = GetComponent("PauseMenuScript"); script3.enabled = true; var script4 = GetComponent("HideCursorScript"); script4.enabled = false; } }

PauseMenuScript:

var newSkin : GUISkin; var logoTexture : Texture2D;

 function thePauseMenu() 
 {
     GUI.BeginGroup(Rect(Screen.width / 2 - 200, 50, 425, 250));
     GUI.Box(Rect(0, 0, 500, 250), "");
     GUI.Label(Rect(15, 10, 300, 68), logoTexture);

     //pause menu buttons
    if(GUI.Button(Rect(80, 20, 250, 70), "Resume")) {
     Time.timeScale = 1.0;
     var script3 = GetComponent("PauseMenuScript"); 
     script3.enabled = false;
     var script4 = GetComponent("HideCursorScript"); 
     script4.enabled = true; 
     }

     if(GUI.Button(Rect(15, 100, 400, 70), "Main Menu")) {
     Application.LoadLevel(0);
     }

     if(GUI.Button(Rect(110, 175, 180, 70), "Quit")) {
     Application.Quit();
     }

     GUI.EndGroup(); 
 }

function OnGUI () { GUI.skin = newSkin;

 Screen.showCursor = true;

 thePauseMenu();

}

Thanks for the help!

Comment
Add comment
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
0
Best Answer

Answer by Justin Warner · Apr 08, 2011 at 12:21 AM

Disable the "Punching" script until the resume button is pushed, in which, enable it...

I don't know anything about sounds... So I can't help you there... This is why you separate questions XD.

Can you just get the sounds, and pause them? http://unity3d.com/support/documentation/ScriptReference/AudioSource.Pause.html

Or can you just turn the volume down a lot of certain sounds? http://unity3d.com/support/documentation/ScriptReference/AudioSource-volume.html

I don't know though.

Comment
Add comment · Show 1 · 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 Derek 1 · Apr 09, 2011 at 12:16 AM 0
Share

I tried to disable punching but it is not working. I don't know if I got the code wrong or if it is not that simple. While the game is paused, you can not punch. However, when you left click resume (thus un-pausing the game) the character punches. Should disableing punching fix this and I just got the code wrong, or is there something else that needs to be done?

avatar image
0

Answer by zmar0519 · Apr 08, 2011 at 01:02 AM

in refrence to your audio, you may have to manually stop all behaviours, since you are using time.timescale. also, see the MainManu.js in the bootcamp demo. its big and it's long, but it somehow uses audio and the timescale together.

Comment
Add comment · 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.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Different music for pause menu? 1 Answer

Audio Toggle Background Music (With Trigger ) 2 Answers

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Can someone help me fix my Javascript for Flickering Light? 6 Answers

how to pause and resume music after pausing game? 4 Answers


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