文档

Unity Engine

Unity Engine

Pause

Pauses the system so no new particles are emitted and the existing particles are not updated.
阅读时间2 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.ParticleSystemModule

Pause(bool)

Pauses the system so no new particles are emitted and the existing particles are not updated.
public void Pause(bool withChildren)

Parameters

withChildren

Pause all child Particle Systems as well.

Remarks

Additional Resources: ParticleSystem.Play, ParticleSystem.Stop functions.
The following example creates a GUI window for manipulating a Particle System.

Examples

using UnityEngine;public class ParticleSystemControllerWindow : MonoBehaviour{ ParticleSystem system { get { if (_CachedSystem == null) _CachedSystem = GetComponent<ParticleSystem>(); return _CachedSystem; } } private ParticleSystem _CachedSystem; public Rect windowRect = new Rect(0, 0, 300, 120); public bool includeChildren = true; void OnGUI() { windowRect = GUI.Window("ParticleController".GetHashCode(), windowRect, DrawWindowContents, system.name); } void DrawWindowContents(int windowId) { if (system) { GUILayout.BeginHorizontal(); GUILayout.Toggle(system.isPlaying, "Playing"); GUILayout.Toggle(system.isEmitting, "Emitting"); GUILayout.Toggle(system.isPaused, "Paused"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Play")) system.Play(includeChildren); if (GUILayout.Button("Pause")) system.Pause(includeChildren); if (GUILayout.Button("Stop Emitting")) system.Stop(includeChildren, ParticleSystemStopBehavior.StopEmitting); if (GUILayout.Button("Stop & Clear")) system.Stop(includeChildren, ParticleSystemStopBehavior.StopEmittingAndClear); GUILayout.EndHorizontal(); includeChildren = GUILayout.Toggle(includeChildren, "Include Children"); GUILayout.BeginHorizontal(); GUILayout.Label("Time(" + system.time + ")"); GUILayout.Label("Particle Count(" + system.particleCount + ")"); GUILayout.EndHorizontal(); } else GUILayout.Label("No Particle System found"); GUI.DragWindow(); }}

Pause()

Pauses the system so no new particles are emitted and the existing particles are not updated.
public void Pause()

Remarks

Additional Resources: ParticleSystem.Play, ParticleSystem.Stop functions.
The following example creates a GUI window for manipulating a Particle System.

Examples

using UnityEngine;public class ParticleSystemControllerWindow : MonoBehaviour{ ParticleSystem system { get { if (_CachedSystem == null) _CachedSystem = GetComponent<ParticleSystem>(); return _CachedSystem; } } private ParticleSystem _CachedSystem; public Rect windowRect = new Rect(0, 0, 300, 120); public bool includeChildren = true; void OnGUI() { windowRect = GUI.Window("ParticleController".GetHashCode(), windowRect, DrawWindowContents, system.name); } void DrawWindowContents(int windowId) { if (system) { GUILayout.BeginHorizontal(); GUILayout.Toggle(system.isPlaying, "Playing"); GUILayout.Toggle(system.isEmitting, "Emitting"); GUILayout.Toggle(system.isPaused, "Paused"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Play")) system.Play(includeChildren); if (GUILayout.Button("Pause")) system.Pause(includeChildren); if (GUILayout.Button("Stop Emitting")) system.Stop(includeChildren, ParticleSystemStopBehavior.StopEmitting); if (GUILayout.Button("Stop & Clear")) system.Stop(includeChildren, ParticleSystemStopBehavior.StopEmittingAndClear); GUILayout.EndHorizontal(); includeChildren = GUILayout.Toggle(includeChildren, "Include Children"); GUILayout.BeginHorizontal(); GUILayout.Label("Time(" + system.time + ")"); GUILayout.Label("Particle Count(" + system.particleCount + ")"); GUILayout.EndHorizontal(); } else GUILayout.Label("No Particle System found"); GUI.DragWindow(); }}