using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class StatesBackDebug : MonoBehaviour { InputField inputField; [System.NonSerialized] public int val; public static StatesBackDebug ins; void Start() { ins = this; inputField = GetComponentInChildren(); //init data val = PlayerPrefs.GetInt("StatesBack-Count", 0); RenderByVal(); } void OnDestroy() { if (ins == this) ins = null; } public void OnEndEdit() { val = int.Parse(inputField.text); if (val < 0) val = 0; if (val > 499) val = 499; PlayerPrefs.SetInt("StatesBack-Count", val); RenderByVal(); } void RenderByVal() { inputField.text = ""; inputField.placeholder.GetComponent().text = "回退帧数:" + val; } }