Hello, I’m working on my first game project. I’ve made the main menu and I’ve added a slider for the volume. My problem is that the volume slider onlys work for main menu scene and I want to work with every scene but I don’t know how to do that. Here’s the code so far
Since you are writing it in a PlayerPref, and I am assuming that you have another VolumeValueChanger in your other scene as well.
Based on the above assumption you can Implement the SceneLoaded Event from Unity SceneManager and re-load the value from PlayerPrefs.
P.S. Two quick Solutions:
Make your object Don’t Destroy On
Load >> In order for it to Persist
between scenes and retain its
values.
Make a sound manager class,
and make it Singleton that also
doesn’t destroy on load