/
TON618OFF
/
Unity-Project-RTU
Обзор
Документация
Войти
/
TON618OFF
/
Unity-Project-RTU
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Library/PackageCache/com.unity.visualscripting@1.9.4/Runtime/VisualScripting.Flow/Framework/Events/Lifecycle/OnDestroy.cs
29 строк
1 KB
TON618OFF
release
03 окт 2024, 22:20
03 окт 2024, 22:20
7c70e9f
Код
Авторство
О чём код?
namespace Unity.VisualScripting { /// <summary> /// Called before the machine is destroyed. /// </summary> [UnitCategory("Events/Lifecycle")] [UnitOrder(7)] public sealed class OnDestroy : MachineEventUnit<EmptyEventArgs> { protected override string hookName => EventHooks.OnDestroy; public override void StopListening(GraphStack stack) { // StopListening is typically triggered when the object is disabled or destroyed // OnDestroy is a special case event where we want it to continue listening even when the object // is disabled. It only unregisters itself on destruction and not before. // That's why this method is overriden to do nothing. } private protected override void InternalTrigger(GraphReference reference, EmptyEventArgs args) { base.InternalTrigger(reference, args); // Stop listening for events after we're triggered (i.e when we're destroyed) using var stack = reference.ToStackPooled(); base.StopListening(stack); } } }