void OnSceneLoaded(Scene scene, LoadSceneMode mode) { isLoading = false; transition = FindObjectOfType <PostProcessDrawColor>(); StartCoroutine(AnimTransition(1, 0)); }
// Start is called before the first frame update void Awake() { if (Instance != null) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); Instance = this; SceneManager.sceneLoaded += OnSceneLoaded; transition = FindObjectOfType <PostProcessDrawColor>(); }
IEnumerator Draw() { PostProcessDrawColor postProcess = GetComponent <PostProcessDrawColor>(); Material originalMat = postProcess.material; postProcess.material = mat; float t = 0; while (t < 1) { t += Time.deltaTime / drawTime; postProcess.intensity = Mathf.Lerp(1, 0, t); yield return(null); } postProcess.material = originalMat; }