Version: 2017.3 (switch to 2017.4)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ParticleSystem.MainModule.stopAction

Switch to Manual
public ParticleSystemStopAction stopAction;

Description

Configure whether the GameObject will automatically disable or destroy itself, when the Particle System is stopped and all particles have died.

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(); } }
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答