using System.Collections; using System.Collections.Generic; using UnityEngine; public class FadeController : MonoBehaviour { public Material[] selfMaters; public bool isFade = false; public float speed = 2; //public bool isGo = false; //public float time = 0; //void Update() //{ // if (isFade) // { // if (selfMaters != null) // { // for (int i = 0; i < selfMaters.Length; i++) // { // float current_Opacity = selfMaters[i].GetFloat("_Opacity"); // float t = Mathf.Lerp(current_Opacity, 1, Time.deltaTime * speed); // if (t > 0.9f) // { // t = 1; // } // selfMaters[i].SetFloat("_Opacity", t); // } // } // } //} public void OnFadeUnFade(bool _isFade) { isFade = _isFade; selfMaters = GetComponent().materials; } }