ProjectDDD/Assets/_Datas/SLShared/SLUnity/UnitSytem/View/SpawnEffect.cs
2025-06-17 20:47:57 +09:00

27 lines
585 B (Stored with Git LFS)
C#

using UnityEngine;
public class SpawnEffect : MonoBehaviour
{
private Animator animator;
private void Start()
{
animator = gameObject.AddComponent<Animator>();
animator.runtimeAnimatorController = SLResources.GetAnimatorController("SpawnEffect");
animator.Play("Animation");
}
private void Update()
{
if (animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 1.0f) return;
Destroy(animator);
Destroy(this);
}
private void OnDisable()
{
Destroy(animator);
Destroy(this);
}
}