using System.Collections; using System.Collections.Generic; using UnityEngine; public class WorkingPersonnel : MonoBehaviour { public static WorkingPersonnel instance; [SerializeField] string isWorkingPersonnel; [SerializeField] GameObject game; private void Awake() { if (instance != null) { Destroy(gameObject); return; } instance = this; DontDestroyOnLoad(gameObject); } // Start is called before the first frame update void Start() { if (string.IsNullOrEmpty(PlayerPrefs.GetString("isWorkingPersonnel"))) { PlayerPrefs.GetString("isWorkingPersonnel", "0"); } else { isWorkingPersonnel = PlayerPrefs.GetString("isWorkingPersonnel"); if (isWorkingPersonnel.Equals("1")) { game.SetActive(false); } } } private void OnDestroy() { PlayerPrefs.SetString("isWorkingPersonnel","0"); } }