Load scene with player prefs from main menu scene

Im trying to load my most recent saved data from the main menu scene. From the main menu scene when i press LOAD it should load the game with the most recent preferences . Currently the save and load is working but only within the Game scene not the Main menu Scene. This is the code below. In the main menu all i’m using is a Scene Manager to load the game.How exactly can i load a game with the loaded data already in place?

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


public class SaveandLoad : MonoBehaviour {

    public GameObject BackgroundMusic;
    public GameObject SFX;

    public GameObject LightIntensity;

    public GameObject muteButton;


    public Toggle [] resolutionToggles;

    public Toggle fullScreen;

     bool muted;


    // Use this for initialization
    void Start () {
   
    }
   
    // Update is called once per frame
    void Update () {

    }

    public void Save(){

        float mastervolume= BackgroundMusic.GetComponent<Slider>().value;
        float SFXvolume=SFX.GetComponent<Slider>().value;
        float Lightintenvalue= LightIntensity.GetComponent<Slider>().value;

        PlayerPrefs.SetFloat("BackgroundMusic",mastervolume);
        PlayerPrefs.SetFloat("SFXvolume",SFXvolume);
        PlayerPrefs.SetFloat("LightInten",Lightintenvalue);




        if(resolutionToggles[0].isOn ==true){
            PlayerPrefs.SetInt("Resolution01",1);
        }
        else if (resolutionToggles[0].isOn ==false){
            PlayerPrefs.SetInt("Resolution01",0);

        }
   
        if(resolutionToggles[1].isOn==true){
            PlayerPrefs.SetInt("Resolution02",1);
        }
        else if (resolutionToggles[1].isOn ==false){
            PlayerPrefs.SetInt("Resolution02",0);

        }
        if(resolutionToggles[2].isOn==true){
            PlayerPrefs.SetInt("Resolution03",1);
        }
        else if (resolutionToggles[2].isOn ==false){
            PlayerPrefs.SetInt("Resolution03",0);

        }

        if(fullScreen.isOn==true){
            PlayerPrefs.SetInt("FullScreen",1);
        }
        else if (fullScreen.isOn ==false){
            PlayerPrefs.SetInt("FullScreen",0);

        }

        if(muted==true)
        {
            PlayerPrefs.SetInt("Muted",1);
        }
        if(muted==false)
        {
            PlayerPrefs.SetInt("UnMuted",0);
        }



    }
       
       
    void Awake(){

        DontDestroyOnLoad(this);
    }

    public void Load(){


        //Debug.Log(PlayerPrefs.GetFloat("BackgroundMusic"));
        BackgroundMusic.GetComponent<Slider>().value=PlayerPrefs.GetFloat("BackgroundMusic");
        SFX.GetComponent<Slider>().value=PlayerPrefs.GetFloat("SFXvolume");
        LightIntensity.GetComponent<Slider>().value=PlayerPrefs.GetFloat("LightInten");

        //Debug.Log(PlayerPrefs.GetInt("Resolution01"));
        //Debug.Log(PlayerPrefs.GetInt("Resolution02"));
        //Debug.Log(PlayerPrefs.GetInt("Resolution03"));


        if(PlayerPrefs.GetInt("Resolution01")==1){
            //Debug.Log("Resolution01");
            resolutionToggles [0].isOn=true;
        }

        if(PlayerPrefs.GetInt("Resolution02")==1){
            //Debug.Log("Resolution02");
            resolutionToggles [1].isOn=true;
       
        }
        if(PlayerPrefs.GetInt("Resolution03")==1){
                //Debug.Log("Resolution03");
            resolutionToggles [2].isOn=true;
        }
        if(PlayerPrefs.GetInt("FullScreen")==1){
            //Debug.Log("FullScreen");
            fullScreen.isOn=true;
        }

        if(PlayerPrefs.GetInt("Muted")==1)
        {
            AudioListener.volume=1;
        }
        if(PlayerPrefs.GetInt("Muted")==0)
        {
            AudioListener.volume=0;
        }


    }

    public void ClickedButton()
    {
        muted= !muted;
        //Debug.Log(AudioListener.volume);
    }


}

Hi, is Muted and UnMuted always sat to 1 and 0 ?
don’t understand… Muted will always have the same value. UnMuted is not used

if(muted==true)


78.        {


79.            PlayerPrefs.SetInt("Muted",1);


80.        }


81.        if(muted==false)


82.        {


83.            PlayerPrefs.SetInt("UnMuted",0);


84.        }

I’m not sure I understand your issue but here are some pointers

That code doesn’t start the game, it just reads values from the playerPrefs, and sets some UI components to reflect that.
When you load a scene, all game objects not marked DontDestroyOnLoad are unloaded. so if you have a SaveLoad in your main menu, call load, and change scene, that object doesn’t exist anymore once you are in-game. You have several options, one of which is calling DontDestroyOnLoad in your Awake or Start function, so the object persists into following scenes.

You should also decouple your save/load from your ui, because right now, either you will take the menu UI into the next scene as well (which might be what you want) or you will only have the saveLoad part referencing UI elements from the previous scene that do not exist in the new scene, causing exceptions to occur.

My suggestion is to have a class to read and write your settings. it could be a singleton or a static class. then whenever you need to access the data, read or write it to/from playerPrefs.

I also advise limiting your use of playerPrefs to well… player prefs. if you need to save and load game progress, you should do so using a file and some serialization (I personally like using JsonUtility)

Hope that helped a little