Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 Anykey · Aug 25, 2011 at 09:06 PM · javascriptaudioslidervolumeaudiolistener

AudioListener.volume doesn't change the volume

Hi everyone ! I've made a custom 3D Slider with a box you can slide here is a part of the code

 function FixedUpdate () {
 
 VolumeSonore = ((gameObject.transform.position.x - 266.57) * 15.953)/100 ;
 
 AudioListener.volume = VolumeSonore  ;
 
 print(VolumeSonore);

 }

so when the box in on the left side of the slider , it prints 0 and when it's on the other side it prints 1 , but the sound doesn't change (there is just a music attached to the main camera).

Actually , when it's on the left side , the music sounds more laggy , but actually as loud as on the right side .

Thanks for reading

Comment
Add comment · Show 4
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 aldonaletto · Aug 25, 2011 at 09:18 PM 0
Share

Could your audio source be using ignoreListenerVolume?

avatar image Anykey · Aug 25, 2011 at 10:27 PM 0
Share

No it's not using ignoreListenerVolume , i've tried adding a script to the camera which makes the ignoreListenerVolume false and true , but both doesn't make it work :/

avatar image Tyler 10 · Aug 25, 2011 at 10:45 PM 0
Share

Is your sound 2d or 3d in the import settings?

avatar image Anykey · Aug 25, 2011 at 11:46 PM 0
Share

my sound was 3D in the import settings , but I changed it to 2D and the volume is still the same when I move the slider :/

4 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by aldonaletto · Aug 26, 2011 at 01:04 AM

I've tested this script and it worked fine. My scene is different, so I had to adapt the numbers - in consequence, the volumeSonore value ranged from -0.5 to +7, but this value is internally clamped to 0..1, so it worked as expected.
I suspect there's something else altering the volume. Could you have some other lost script changing the volume elsewhere? Try to create a new scene and place only the essential objects to see if it works.

Comment
Add comment · Show 2 · 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 Anykey · Aug 26, 2011 at 11:21 AM 0
Share

I feel so dumb , the script was applied at another object I forgot about , I thought the only fact that it was printing the good value would be enough .

Thank you so much !

avatar image aldonaletto · Aug 26, 2011 at 11:37 AM 2
Share

This happens very often: scripts forgotten or attached to wrong objects by mistake are hard to find, and may bother us to death

avatar image
0

Answer by Beeblebrox · Jul 22, 2016 at 07:39 PM

Another possibility: you have more than one AudioListener in the scene.

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 Bunny83 · Jul 22, 2016 at 08:11 PM 0
Share

In that case Unity would spam warnings in the console. You can't miss that.

avatar image
0

Answer by Joa1n · Mar 27, 2020 at 12:11 PM

Your code is updating a saved value in PlayerPrefs called VolumeLevel, but it doesn't actually tell Unity to change the volume at any point.

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 Maldonad1o · Oct 10, 2020 at 05:47 AM

Your code is refreshing a spared an incentive in player preferences called volume level, yet it doesn't really advise Unity to change the volume anytime mycfavisit

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

9 People are following this question.

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

Related Questions

Why does AudioListener boost my volume using values over 1 when the documentation says its normalized between 0.0 and 1.0? 1 Answer

How do I only start the audio when player is at max distance 1 Answer

Volume Slider 0 Answers

Why does my audio cut out completely when I try to edit volume? (Java) SOLVED! 1 Answer

Linear volume control of AudioMixer groups 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