Files

41 lines
1.1 KiB
C#
Raw Normal View History

2025-06-05 22:59:18 +01:00
using System;
using System.Linq;
using UnityEngine;
using UnityEngine.VFX;
namespace UnityEditor.VFX
{
class LaunchEventBehavior : IPushButtonBehavior
{
public void OnClicked(string value)
{
var allComponent = UnityEngine.VFX.VFXManager.GetComponents();
foreach (var component in allComponent)
{
component.SendEvent(value);
}
}
}
[VFXHelpURL("Context-Event")]
[VFXInfo(name = "Event", category = "#1Event")]
class VFXBasicEvent : VFXContext
{
[VFXSetting, PushButton(typeof(LaunchEventBehavior), "Send"), Delayed]
public string eventName = VisualEffectAsset.PlayEventName;
public VFXBasicEvent() : base(VFXContextType.Event, VFXDataType.None, VFXDataType.SpawnEvent) { }
public override string name { get { return "Event"; } }
public override VFXExpressionMapper GetExpressionMapper(VFXDeviceTarget target)
{
return null;
}
public override bool CanBeCompiled()
{
return outputContexts.Any(c => c.CanBeCompiled());
}
}
}