Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 RolfBertram-com · Aug 23, 2011 at 02:53 AM · musicvolume

Music Volume

Almost every game has background music. There must be working example scripts on how to change the volume! It seems I need to hire someone on Elance to get a working script. I already posted a job listing for this and other tricky questions. I assume a programmer fluent in Unity3D JS could type this code in less than 5 minutes. I already wasted a day on this, which is way to much time.

Problem is, the music is started with the startup screen, obviously. It's attached to an object with DoNotDestroy script, so it keeps playing when scenes change. Now, changing the volume from the settings screen of the game just is the hard problem. Should that not be in standard Q&A, or a script that is included with Unity3D, since pretty much everyone needs that?

Comment
Add comment · Show 1
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 RolfBertram-com · Aug 23, 2011 at 10:13 PM 0
Share

Thanks to those who answered. The problem appears to be more complex than expected. A DoNotDestroy will cause to play the music multiple times, adding one each time when returning to the start scene. I gave up on trying to solve this, and decided to circumvent the problem by not using DoNotDestroy, and ins$$anonymous$$d playing the music only in the game scene. It will of cause stop when leaving the scene, and restart from the beginning when re-entering the scene.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Joshua · Aug 23, 2011 at 03:01 AM

5 minutes? More like 30 seconds. Just change the volume..

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
avatar image
0

Answer by madflyskills · Jun 13, 2013 at 12:07 AM

You should check out SoundManagerPro, it handles this exact type of situation. Otherwise, you should try using a singleton that destroys itself if another instance of it exists:

http://wiki.unity3d.com/index.php?title=Singleton

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Separate Listeners for Sound FX and Music? 0 Answers

Music volume decreases after one loop 1 Answer

Problem implementing volume slider 1 Answer

Unity and music tracks - load track at certain point and fading tracks in and out 1 Answer

Low sound volume on phone speaker but normal on headphone 0 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