using System.Collections; using System.Collections.Generic; using UnityEngine; public class Dissolver : MonoBehaviour { private Material mat; private float time; private bool isEnabled; private void Start() { mat = GetComponent().material; } private void Update() { if (time <= 1f && isEnabled) { time += Time.deltaTime / 2f; mat.SetFloat("_DissolveAmount", time); } } public void Enabled() { isEnabled = true; time = -1f; } }