unity3d 如何控制物体的粒子系统播放特效和停止特效?
首先说下主要代码
gameObject.GetComponent<ParticleSystem>().Play();播放
gameObject.GetComponent<ParticleSystem>().Pause();暂停
gameObject.GetComponent<ParticleSystem>().Stop();停止
下面是具体代码
public GameObject shellExplosionPrefab; //先设置预制件
public void OnTriggerEnter(Collider collider) {
shellExplosionPrefab.GetComponent<ParticleSystem>().Play();
}