Skip to content

Commit ab77db8

Browse files
committed
Explicitly check for Event.IsCancelled before execution
1 parent 0f06b68 commit ab77db8

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Assets/UnityEventTimeline/Runtime/TimelineEvent.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,12 @@ public virtual void Reset()
126126
/// </summary>
127127
/// <returns>
128128
/// true if the event can be executed; false if it should be skipped.
129-
/// By default, returns true only if the event is not cancelled.
130129
/// </returns>
131130
/// <remarks>
132131
/// This virtual method can be overridden by derived classes to add
133132
/// additional execution conditions beyond the basic cancellation check.
134133
/// </remarks>
135-
protected virtual bool CanExecute()
136-
{
137-
return !IsCancelled;
138-
}
134+
protected virtual bool CanExecute() => true;
139135

140136
/// <summary>
141137
/// Internal method that handles the event execution process.
@@ -147,7 +143,7 @@ protected virtual bool CanExecute()
147143
/// </remarks>
148144
internal virtual void ExecuteInternal()
149145
{
150-
if (CanExecute())
146+
if (IsCancelled || CanExecute())
151147
{
152148
Execute();
153149
}
@@ -354,7 +350,7 @@ protected TimelineEvent()
354350
/// </remarks>
355351
internal override void ExecuteInternal()
356352
{
357-
if (!CanExecute())
353+
if (IsCancelled || !CanExecute())
358354
{
359355
return;
360356
}

Assets/UnityEventTimeline/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "io.ahmedkamal.unity.eventtimeline",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"displayName": "UnityEventTimeline",
55
"description": "A thread-safe event scheduling and timeline management system for Unity with efficient object pooling, priority-based event queue, and model-based state management. Features plug-and-play setup, time scaling, scene transition handling, and automatic memory optimization.",
66
"unity": "2021.3",

0 commit comments

Comments
 (0)