Skip to content

Instantly share code, notes, and snippets.

@tsubaki tsubaki/DisableParticle.cs
Last active Feb 11, 2018

Embed
What would you like to do?
パーティクル再生終了後、オブジェクトを非アクティブへ
using UnityEngine;
using System.Collections;
public class DisableParticle : MonoBehaviour
{
void OnEnable()
{
StartCoroutine (ParticleWorking ());
}
IEnumerator ParticleWorking()
{
var particle = GetComponent<ParticleSystem> ();
yield return new WaitWhile (() => particle.IsAlive (true));
gameObject.SetActive (false);
}
}
@tsubaki

This comment has been minimized.

Copy link
Owner Author

commented Mar 2, 2016

再利用を前提とするため、OnEnable時にコルーチンを起動。コルーチンの停止処理はGameObjectにお任せする

@lovelyappleHoge

This comment has been minimized.

Copy link

commented Feb 11, 2018

これでしたか!
ありがとうございます!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.