Version: 2020.3
public ParticleSystemStopAction stopAction ;

描述

选择当粒子系统停止并且所有粒子都湮灭时,是禁用或销毁 GameObject,还是调用 OnParticleSystemStopped 脚本回调。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { private ParticleSystem ps;

void Start() { ps = GetComponent<ParticleSystem>(); ps.Stop();

var main = ps.main; main.loop = false; main.duration = 1.0f; main.stopAction = ParticleSystemStopAction.Destroy;

ps.Play(); } }