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 surfuay · Apr 25, 2019 at 05:10 PM · booleanvolumemute

volume manager from scene to scene

Hey everyone,

volume manager works great.....however. I have the same script attached to 2 volume buttons WHICH ARE TOGGLES. 1 on my start scene, another on my play scene since they have different sounds they control. Below is my script and then my question.

  public bool isMute;
 
 public void IsMute()
 {
     isMute = !isMute;
     AudioListener.volume = isMute ? 0 : 1; 
 }


so! on the start scene if I press the toggle, it will change the sprite (good) and the mute will carry over to the play scene (ALSO GOOD). the problem is the volume toggle in the play scene will not be on the right setting, so I will have to press it twice. once to get it to the correct sprite for the current volume setting and then again so that I can actually unmute it.

   //how do i make it so that the toggle is already on the correct setting so that I only have to push it once instead of twice in the other scene
Comment
Add comment · Show 8
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 Magso · Apr 25, 2019 at 05:31 PM 0
Share

How are you changing the sprite? Is$$anonymous$$ute might not be being called the first time.

avatar image surfuay Magso · Apr 26, 2019 at 06:18 PM 0
Share

it's just a toggle, and the sprite looks like it's being changed when i press it, i definitely get the sprite swap to occur

avatar image Magso surfuay · Apr 26, 2019 at 09:03 PM 0
Share

Do you have a script for this? if so you could add something like

 AudioListener.volume = GetComponent<Toggle>().isOn ? 0 : 1;

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Nishchhal · Apr 30, 2019 at 07:32 PM

Why don't you add a Check to the Volume Checker Script which changes the sprite to mute or unmute. Like add this in an Init Method for that script that actually sets up the starting images or starting UI or simply add this check inside that Start Method which you use to change sprite

if(isMute) { //Enable Mute Sprite //Disable Unmute Sprite }

else { //Enable Unmute Sprite //Disable Mute Sprite }

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

108 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

Related Questions

Muting Audio 2 Answers

Mute volume / sound problem 1 Answer

Setting audio volume with horizontal slider (to many AudioSources with different volume) 2 Answers

Changing Music Volume = Calling a function in another script in another scene 2 Answers

Separate Listeners for Sound FX and Music? 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