using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering.PostProcessing; public class NetworkStatsMenu : MonoBehaviour { public CanvasGroup leaderboard; public PostProcessVolume pp; DepthOfField depthOfField; float defaultDof; void Start() { pp.profile.TryGetSettings(out depthOfField); defaultDof = depthOfField.focusDistance; } public float leaderboardOpacity= 0; void Update() { if(Input.GetKey(KeyCode.Tab)){ leaderboardOpacity = Mathf.Lerp(leaderboardOpacity, 1, 0.1f); }else{ leaderboardOpacity = Mathf.Lerp(leaderboardOpacity, 0, 0.1f); } if(leaderboardOpacity < 0.1f){leaderboardOpacity=0;} leaderboard.alpha = leaderboardOpacity; // depthOfField.focusDistance.value = (1-leaderboardOpacity) * defaultDof; } }