• 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 SatyrFrost · Oct 30, 2018 at 09:57 AM · sceneslidervolumemainmenu

Options Menu with volume sliders accessible from Main Menu scene and Game scene

Hi Noob here, and I've watch many videos showing how to make sliders that control music and sound effects volumes. This has worked fine. For example https://www.youtube.com/watch?v=EA-tBcTxE8M&t=1635s

My Main Menu is a scene. It allows you to click options, where a new object/canvas/panel is set active to allow the changing of 2 sliders. The volumes are set fine.

What about accessing this Options Menu by pressing the ESCAPE key while playing the game. I am having difficulty and I have spent hours going around in circles.

  • I cannot load the Main Menu scene again because this would stop and reset the progress of the game.

  • I (maybe) should not make a new GameObject/Canvas/Sliders because this is duplication, and it may be difficult to access the scripts or AudioSources.

  • What I have been trying is making the MenuManager object and therefore script DontDestroyOnLoad, making the AudioManager object and therefore script DontDestroyOnLoad, and the OptionsUI object DontDestroyOnLoad.

This has caused hours of headaches. Since I don't want the OptionsUI to show when the game loads, I need to set it to inactive. But if it is inactive, when I enter the game scene, I cannot get a reference to it and therefore I cannot show it again if the user presses ESC. So I fixed this with placeholder objects and using the scripts to find the OptionsUI on Awake and then quickly set it inactive. But then I've had trouble with duplicate GameObjects when returning to the Main Menu, and I've played with singletons, and I've created a mess.

I think I am going about this all wrong. So my question is:

What is the best way to have a volume slider for music and a volume slider for sound effects accessible from multiple scenes?

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
1
Best Answer

Answer by Casiell · Oct 30, 2018 at 02:07 PM

Have your managers on an always active game object and only turn on/off your UI. Also keep a reference to UI in managers so you never have to look for it from outside.

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 Solid_9 · Sep 10, 2021 at 12:42 PM

My problem is pretty much but the difference is that I want to change volume from menu scene and have effect on game scene. I don't want to change the volumes for game scene. So for that, I created 2 empty objects 1in menu scene and other one in game scene with same audio clip but i can't access the audio source from game scene(since it's not created). So, what should i do? ,My problem is pretty much but the difference is that I want to change volume from menu scene and have effect on game scene. I don't want to change the volumes for game scene. Any help??

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.

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

114 People are following this question.

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

Related Questions

Problems with pulling a slider value - (Making sensitivity Sliders) 0 Answers

Getting the Value of a slider with 4.6 UI 2 Answers

How to have music not restart between scenes? 1 Answer

AudioListener.volume doesn't change the volume 4 Answers

Can I attach AudioSource.PlayClipAtPoint to an Audio Mixer, so I can control the volume of these gameobjects? 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