using System.Collections; using System.Collections.Generic; using UnityEngine; public class ChoosePage : MonoBehaviour { public Transform sureBtn; public Transform cancleBtn; private void OnEnable() { sureBtn.GetChild(0).gameObject.SetActive(true); cancleBtn.GetChild(0).gameObject.SetActive(false); } // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.LeftArrow)) ChangeBtnState(); if(Input.GetKeyDown(KeyCode.RightArrow)) ChangeBtnState(); if (Input.GetKeyDown(KeyCode.Return)) { gameObject.SetActive(false); } } //ÿ´ÎÇл»×´Ì¬ public void ChangeBtnState() { sureBtn.GetChild(0).gameObject.SetActive(!sureBtn.GetChild(0).gameObject.activeInHierarchy); cancleBtn.GetChild(0).gameObject.SetActive(!cancleBtn.GetChild(0).gameObject.activeInHierarchy); } }