using System.Collections; using System.Collections.Generic; using Sirenix.OdinInspector; using UnityEngine; using DG; using DG.Tweening; public class SpiritWorldEffectAnimator : MonoBehaviour { [SerializeField] MeshRenderer m_mesh; Material m_material; public float m_dissolveTime = 3f; public float m_cutoutThMaxValue = 0.9f; private void Awake() { if (m_mesh == null) m_mesh = GetComponent(); if (m_mesh == null) { Debug.LogError("No mesh renderer found!"); return; } m_material = m_mesh.material; } [Button] void Uncreate() { DOTween.Kill(m_material); m_material.SetFloat("_CutoutTh", m_cutoutThMaxValue); m_material.DOFloat(0f, "_CutoutTh", m_dissolveTime); } [Button] void Create() { DOTween.Kill(m_material); m_material.SetFloat("_CutoutTh", 0f); m_material.DOFloat(m_cutoutThMaxValue, "_CutoutTh", m_dissolveTime); } }