Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
Fixed bug that the root coroutines were not removed from the active list once they finished.
  • Loading branch information
Inspiaaa committed Sep 5, 2024
1 parent 732aece commit e7525b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/CoroutineBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class CoroutineBase
/// Determines the pause behaviour of this coroutine.
/// </summary>
public CoRunMode RunMode { get; private set; }

public event Action Stopped;

public void StartCoroutine(CoroutineBase coroutine)
{
Expand Down Expand Up @@ -191,6 +193,7 @@ public void Kill()
}

Parent?.OnChildStopped(this);
Stopped?.Invoke();
}

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/CoroutineManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public partial class CoroutineManager : Node
public void StartCoroutine(CoroutineBase coroutine)
{
coroutine.Manager = this;
coroutine.Stopped += () => aliveRootCoroutines.Remove(coroutine);
coroutine.Init();
aliveRootCoroutines.Add(coroutine);
}
Expand Down

0 comments on commit e7525b7

Please sign in to comment.