I’m currently trying use PlayerPrefs to allow the player to save their audio settings.
I have linked the audio source that’s connected to the main camera to a script that loads the PlayerPrefs.
There is also the volume slider that sets itself according to the volume saved.
When I run the game, both Audio Source and Slider get removed from the Script but re-appear after exiting the game.
I figured out the issue. I was referencing the Audio Source and Slider with GetComponent which looks for the components attached to the GameObject. I didn’t have those attached to the GameObject because I wanted to use an already existing Audio Source and Slider.
I used tags on both GameObjects that had the components I wanted to reference and used FindGameObjectWithTag in the script. It now does what I want it to do.