DontDestroyonLoad works in Unity but not in Build

So I have a background music that I put in DontDestroyonLoad for. It works fine in Unity, but it doesn’t work in the build. When I press play, the music starts over.

Hi Asli,

Please add the following line to the if-block with the Destroy method: gameObject.SetActive(false);. The game object does not get destroyed immediately, so it might be that the superfluous instance exists for a while and is found by other game objects/instances.

1 Like

Thanks!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.