mirror of
https://github.com/Ellpeck/Coroutine.git
synced 2024-11-22 05:43:29 +01:00
Ensure that event coroutines never get duplicated when duplicate events are raised
This commit is contained in:
parent
cf1b3c2db0
commit
ff8749a799
1 changed files with 2 additions and 0 deletions
|
@ -97,6 +97,8 @@ namespace Coroutine {
|
||||||
/// <param name="evt">The event to raise</param>
|
/// <param name="evt">The event to raise</param>
|
||||||
public void RaiseEvent(Event evt) {
|
public void RaiseEvent(Event evt) {
|
||||||
for (var i = 0; i < this.eventCoroutines.Count; i++) {
|
for (var i = 0; i < this.eventCoroutines.Count; i++) {
|
||||||
|
if (this.eventCoroutinesToRemove.Contains(i))
|
||||||
|
continue;
|
||||||
var c = this.eventCoroutines[i];
|
var c = this.eventCoroutines[i];
|
||||||
if (c.OnEvent(evt)) {
|
if (c.OnEvent(evt)) {
|
||||||
this.eventCoroutinesToRemove.Add(i);
|
this.eventCoroutinesToRemove.Add(i);
|
||||||
|
|
Loading…
Reference in a new issue