Newer
Older
TEST / Assets / Scripts / StartUpSetting.cs
@a_kuznecov a_kuznecov on 20 Jun 2023 646 bytes First Commit
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StartUpSetting : MonoBehaviour
{
    [SerializeField] private GameObject audioSource;
    void Start()
    {
        if (PlayerPrefs.HasKey("Mute"))
        {
            PlayerPrefs.SetInt("Mute", 0);
        }
        if (PlayerPrefs.GetInt("Mute") == 0)
        {
            audioSource.SetActive(true);
        }
        else
        {
            audioSource.SetActive(false);
        }
    }

    public void Mute()
    {
        PlayerPrefs.SetInt("Mute", 1);
    }

    public void UnMute()
    {
        PlayerPrefs.SetInt("Mute", 0);
    }
}