GetEvents(List<string>)
Gets the name of every Event connected to a system.
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Method
- Namespace: UnityEngine.VFX
- Assembly: UnityEngine.VFXModule
public void GetEvents(List<string> names)
Parameters
The List that this function populates with the event system names.
Remarks
To increase the speed of the retrieval process, preallocate the input list.
namesThis example logs all available events in the attached .
VisualEffectAssetAdditional Resources: VisualEffect.SendEvent
Examples
using System.Collections.Generic;using UnityEngine;using UnityEngine.VFX;[ExecuteInEditMode]class LogEventNames : MonoBehaviour{ // Called when the script or GameObject is enabled void OnEnable() { VisualEffect vfx = GetComponent<VisualEffect>(); if (vfx != null && vfx.visualEffectAsset != null) { VisualEffectAsset vfxAsset = vfx.visualEffectAsset; var eventNames = new List<string>(); // Retrieve all events from the VisualEffectAsset and store them in the list vfxAsset.GetEvents(eventNames); if (eventNames.Count == 0) { Debug.Log($"There are no events listed for asset: {vfxAsset}"); } foreach (var eventName in eventNames) { Debug.Log($"Event: {eventName}"); } } else { Debug.Log("Unable to retrieve VisualEffect component or VisualEffectAsset is null."); } }}