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
1
Question by Jesse Anders · Oct 15, 2010 at 05:08 AM · sceneloadlevelmusic

[Unity 3] Music playback stops unexpectedly when loading a new level

Has anyone run into problems with audio sources marked as "don't destroy on load" stopping playback spontaneously when a new level is loaded? This would be in reference to (for example) playing a music track continuously from one level to another.

The only relevant thread I could find was this one, in which the OP describes what sounds like the same problem.

I've had some trouble reproducing the behavior consistently, but here are some things I've noticed:

  • Playback seems to stop somewhere between the call to OnDisable() prior to loading the new level and the call to OnEnable() that follows loading the level ('isPlaying' is true in the former and false in the latter).

  • At the point the audio stops, I can see in the inspector that the doppler level and min and max distances for the audio source have been reset from their default values to 0, 0, and .1, respectively.

Has anyone else run into this problem or problems like it? Is it a known bug? (I'll file a bug report, but as this basically means no music across level loads, I'd like to at least try to find out if it's user error, and if not, whether there's a workaround.)

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

Answer by jehna · Jul 12, 2011 at 01:27 PM

Try changing Load Type of sound's AudioImporter to Stream from Disk. Sometimes Unity destroyed the sound from memory while unloading the scene.

Also make sure that your AudioListener is not destroyed.

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 azzogat · Nov 27, 2010 at 04:24 PM

If you know what's getting reset, I suppose you can just invoke a function that checks that (on load) and changes it back again.

if(AudioSource.minDistance < x.x){
AudioSource.minDistance = y.y
andSoOn;
} 

Better yet, you can use a case switcher. It's a bit of extra code but it sure beats not having sound.

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 Jesse Anders · Nov 27, 2010 at 07:20 PM 0
Share

Thanks for replying (this was a while ago!). Unfortunately, the problem isn't so much the values that are getting reset (although that's certainly a symptom), but rather that playback stops. Sure, you could check to see if the sound is playing and restart playback if it's not, but unless there's something I don't understand about the audio system, you shouldn't have to do that. (I've submitted a bug report, but meanwhile, the cause of the problem remains a mystery.)

avatar image Daniel-Brauer · Dec 02, 2010 at 07:03 PM 0
Share

We're having what looks like exactly the same problem. Any progress on that bug report?

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

1 Person is following this question.

avatar image

Related Questions

Multiple Instances of My Current Scene? 0 Answers

What is the Difference betwwen a "Level" and a "scene" 2 Answers

How can I save the player's progress in-game? 1 Answer

Anyway to save which seen the player was on, then load that scene back from another one at a different time? 2 Answers

Load Scene by audio clip 2 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