Scriptum/Assets/ControlsletterManager.cs

26 lines
714 B
C#
Raw Normal View History

2023-01-05 20:13:14 +01:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ControlsletterManager : MonoBehaviour
{
public GameObject LetterPanel;
public GameObject _panel;
// Start is called before the first frame update
void Start()
{
if (PlayerPrefs.GetInt("ControlLetter.WhereDisplayed") == 0)
{
_panel = Instantiate(LetterPanel, GameObject.FindGameObjectWithTag("GUI").transform);
_panel.transform.Find("Button").GetComponent<UnityEngine.UI.Button>().onClick.AddListener(DestroyLetter);
}
}
void DestroyLetter()
{
Destroy(_panel);
PlayerPrefs.SetInt("ControlLetter.WhereDisplayed", 1);
}
}