Cancel Event#
Control / Cancel Event
Description#
Cancels the execution of an Event
Parameters#
| Name | Description |
|---|---|
| Event | The Event component to cancel |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Cancel Event")]
[Image(typeof(IconInstructions), ColorTheme.Type.Red, typeof(BadgeBolt))]
[Description("Cancels the execution of an Event")]
[Category("Control/Cancel Event")]
[Parameter("Event", "The Event component to cancel")]
[Keywords("Stop", "Exit", "Cancel", "Event")]
[Serializable]
public class InstructionCoreCancelEvent : Instruction
{
[SerializeField] private GetGameObject m_Event = new GetGameObject(
new TypeGameObjectComponentEvent()
);
protected override string GetTitle(GameObject source) => $"Cancel {this.m_Event}";
protected override Awaitable Run(Args args)
{
Event eventComponent = this.m_Event.Get<Event>(args);
eventComponent.Stop();
return Done;
}
}
}