Version: 2022.1
언어: 한국어

VFXSpawnerState

class in UnityEngine.VFX

매뉴얼로 전환

설명

The spawn state of a Spawn system.

This class is useful for debugging a Visual Effect's spawner. For example, you can see if the effect is currently playing, the number of loops the spawner has processed, as well as the current state of the spawner.

To access the state of a Visual Effect's Spawn system, either use VisualEffect.GetSpawnSystemInfo or, in a class that inherits from VFXSpawnerCallbacks, override the OnUpdate method.

using UnityEngine;
using UnityEngine.VFX;

class ConstantRateEquivalent : VFXSpawnerCallbacks { public class InputProperties { [Min(0), Tooltip("Sets the number of particles to spawn per second.")] public float Rate = 10; }

static private readonly int rateID = Shader.PropertyToID("Rate");

public sealed override void OnPlay(VFXSpawnerState state, VFXExpressionValues vfxValues, VisualEffect vfxComponent) { }

public sealed override void OnUpdate(VFXSpawnerState state, VFXExpressionValues vfxValues, VisualEffect vfxComponent) { if (state.playing) { float currentRate = vfxValues.GetFloat(rateID); state.spawnCount += currentRate * state.deltaTime; } }

public sealed override void OnStop(VFXSpawnerState state, VFXExpressionValues vfxValues, VisualEffect vfxComponent) { } }

변수

delayAfterLoopThe current delay time that the VFXSpawner waits for after it finishes a loop.
delayBeforeLoopThe current delay time that the VFXSpawner waits for before it starts a loop.
deltaTimeThe current delta time.
loopCountThe current loop count.
loopDurationThe duration of the looping state.
loopIndexThe current index of loop.
loopStateThe current state of VFXSpawnerState.
newLoopThis boolean indicates if a new loop has just started.
playingThe current playing state.
spawnCountThe current Spawn count.
totalTimeThe accumulated delta time since the last Play event.
vfxEventAttributeGets the modifiable current event attribute (Read Only).
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961