- Home /
In-game music plays when editor stopped, does not play in 'play mode'
Exactly what the title says. When I play my game in the unity engine, the music that is supposed to be playing in-game doesn't work, but the sound effects do. When I stop the play mode the music just plays unexpectedly. I've restarted unity several times but the issue is still present. Also this literally just started happening right now.
What should I do?
No suggestions at all? If needed I can provide a video demonstrating the issue
Please do. $$anonymous$$ake sure you include a view of your AudioSource setup and any pertinent code when you do.
No changes were done since it started happening the problem literally came up out of nowhere after making a quick build.
I know it sound silly but the first thing i do when unity is acting out is to restart it. So if you didn't do it already, restart unity and see if its still happening.
Yeah, that was the first thing I did, I even tried restarting my computer and opening with a completely different version of Unity and it still does it, but only for me.
I use the unity collab editor for another project and the same problems happens, but only on my end. The other person does not experience this problem. Also when I make a build, everything works as it should.
Answer by Konsicrafter · Jan 28, 2017 at 06:57 PM
Could you maybe post (or show in a video) your methods where the music is played? Maybe add some Debug.Log() calls before the play starts. Is the AudioSource-setting "PlayOnAwake" active? You could try to call the Play() method in the AudioSource instead by implementing it in any script in the start method. You could also try to build the project again. - Does the music play normally in the build? - Does the music start when you close the build?
My last idea would be to clear the unity cache and to change the platform to android or so, then switch it back to reload some settings.
The builds have no problems and everything works as intended, it's only in the editor that there is a problem. Changing the platform didn't change the editor results unfortunately, but I'm not sure how to clear the Unity cache, how would I do that?
I posted a video demonstrating the problem, but here it isin case you didn't see it. The music is PlayOnAwake active and doesn't have any scripts calling to start or stop it. Telling it to start in a script would probably work, but doing this for each scene would be a lot of work and would simply be a workaround.
To clear the unity GI cache, navigate to Edit->Preferences->GI Cache->Clear cache.
Please try to create a script and play the music in the start method and disable "PlayOnAwake". So we can find out, where the error is. You only have to make this in one scene, we can then proceed with analyzing the problem.
What unity versions are you using? I experienced some issues with the current beta version
Your answer
![](https://koobas.hobune.stream/wayback/20220612105623im_/https://answers.unity.com/themes/thub/images/avi.jpg)