Version: 2020.3

MonoBehaviour.OnParticleSystemStopped()

切换到手册

描述

系统中的所有粒子都死亡时,便会调用 OnParticleSystemStopped,然后将不再产生新粒子。在调用 Stop 之后,或者超过非循环系统的 Duration 属性时,将停止产生新粒子。

这可以用来向脚本通知粒子系统何时结束。 为了接收回调,必须将 ParticleSystem.MainModule.stopAction 属性设置为 Callback。

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class StoppedScript : MonoBehaviour { void Start() { var main = GetComponent<ParticleSystem>().main; main.stopAction = ParticleSystemStopAction.Callback; }

void OnParticleSystemStopped() { Debug.Log("System has stopped!"); } }

In order to retrieve detailed information about all the collisions caused by the ParticleSystem, you must use ParticlePhysicsExtensions.GetTriggerParticles to retrieve the array of Particle.


Did you find this page useful? Please give it a rating: