using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.UI; /// /// отмена создания стены, маяка, зоны /// public class HistoryController : MonoBehaviour { public Button redo; public Button undo; // отмена public List histories = new List(); // Start is called before the first frame update void Start() { undo.onClick.AddListener(Undo); } // Update is called once per frame void Update() { } void Undo() { var last = histories.Last(); last.obj.SetActive(false); last.ButtonPanel.SetActive(false); last.status = false; } public void EventHistory(uint id, GameObject gameObject, GameObject panel) { histories.Add(new History { id = id, obj = gameObject, ButtonPanel = panel, status = true }); } }