Skip to content

Commit a688f83

Browse files
committed
Do nothing if the correct update strategy is already set
1 parent b4c32d0 commit a688f83

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Runtime/Execution/UpdateBehavior.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ private void UpdateStrategy()
9898
/// <typeparam name="T">The type of update strategy to set.</typeparam>
9999
private void SetStrategy<T>() where T : UpdateStrategy
100100
{
101+
// Do nothing if the strategy is already set to the given type
102+
if (strategy is T) {
103+
return;
104+
}
105+
101106
// Unregister from the existing strategy
102107
if (strategy != null) {
103108
strategy.Unregister(OnUpdate);

0 commit comments

Comments
 (0)