Please help how to add that the sprite saves when change scene

So i created a script for my audio. But when i click on my mute/unmute button it goes to sprite off. And when i click it for the second time its set to on whats supossed to happen. (by on or off the sprite chanches) But when i go to a diffrent scene the sprite returns to on while the audio is off <sprite = musicOff.png or musicOn.png file>
So i need a way that the sprite saves to off and gets loaded back to off when i revisit the MainMenu scene

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Manager : MonoBehaviour {
   
    public GameObject soundControlButton;
    public Sprite audioOffSprite;
    public Sprite audioOnSprite;
   
    //use this for initialization
    void start() {
        if (AudioListener.pause == true) {
            soundControlButton.GetComponent<Image> ().sprite = audioOffSprite;
        } else {
            soundControlButton.GetComponent<Image> ().sprite = audioOnSprite;
        }
    }
   
    //Update is called once per frame
    void Update () {
   
    }
   
    public void SoundControl(){
        if (AudioListener.pause == true){
            AudioListener.pause = false;
            soundControlButton.GetComponent<Image> ().sprite = audioOnSprite;
        } else {
            AudioListener.pause = true;
            soundControlButton.GetComponent<Image> ().sprite = audioOffSprite;
        }   
    }
}

Capitalization and spelling and punctuation are CRITICAL in programming.

Line 13 above, the correct spelling for the Unity MonoBehavior “Start()” function requires an uppercase S.

1 Like

Tnx u made my day :slight_smile:

1 Like