using System.Collections; using System.Collections.Generic; using UnityEngine; public class UI : MonoBehaviour { private CanvasGroup UICanvas; private float alpha = 0; private float speed = 10; void Start() { UICanvas = this.GetComponent(); } void Update() { UICanvas.alpha = Mathf.Lerp(UICanvas.alpha, alpha, speed * Time.deltaTime); } public void EnterUIShow() { alpha = 1; GameObject.Find("Main Camera").GetComponent().canScroll = false; } public void ExitUIHide() { alpha = 0; GameObject.Find("Main Camera").GetComponent().canScroll = true; } }