using System.Collections; using System.Collections.Generic; using UnityEngine; public class DissolveEffect : MonoBehaviour { public float Time; List _renderer = new List(); void Start() { _renderer.AddRange(GetComponentsInChildren()); } [ContextMenu("Dissolve")] public void Dissolve() { LeanTween.value(0, 1, Time).setOnUpdate((float x) => { for (int i = 0; i < _renderer.Count; i++) { for (int h = 0; h < _renderer[i].materials.Length; h++) { _renderer[i].materials[h].SetFloat("_Dissolve", x); } } }); } }