You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
462 B
21 lines
462 B
using UnityEngine; |
|
using System.Collections; |
|
|
|
public class DestroyParticle : MonoBehaviour |
|
{ |
|
void Start() |
|
{ |
|
//开启协程 |
|
StartCoroutine(CreateParticle()); |
|
} |
|
|
|
IEnumerator CreateParticle() |
|
{ |
|
//当粒子还在播放中 |
|
while (gameObject.GetComponent<ParticleSystem>().isPlaying) |
|
{ |
|
yield return null; //条到下一帧 |
|
} |
|
Destroy(gameObject); //粒子播放结束 |
|
} |
|
} |