Answers for "how to save toggle values unity"

C#
0

how to save toggle values unity

public Toggle Toggle;

    private void Start() {
        if ((PlayerPrefs.GetInt("ToggleBool") == 1)) {
            Toggle.isOn = true
        }
        else {
            Toggle.isOn = false;
        }
    }

    private void Update() {
        if (Toggle.isOn == true) {
            PlayerPrefs.SetInt("ToggleBool", 1);
        }
        else {
            PlayerPrefs.SetInt("ToggleBool", 0);
        }
Posted by: Guest on October-30-2020

Code answers related to "how to save toggle values unity"

C# Answers by Framework

Browse Popular Code Answers by Language