Skip to content

Found A Bug but also a Fix. #1

@Shmellyorc

Description

@Shmellyorc

Hello! First off I want to say I enjoy your coroutine runner. I have tried others and they are too complicated and thanks for sharing this awesome library.

I do game development with Monogame and converted your coroutine to an UpdatableGameComponent that runs it thru Monogame Deltatime. I dont know if its is only a monogame issue but I found a bug that happens when an coroutine gets removed, the loop still uses that current index or goes above the maximum array index which causes out of bounds error.

Probably didnt see this error because only doing a few coroutines it wont show this error. It will show this error if you got hundreds of coroutines. I have one scene of snow falling. I use a coroutine so I can re-use the snow array index instead of creating a new snow. Pretty much stop the GC from going crazy.

Anyways this is what I did to fix it, it may look slightly different as your method because its thru monogame update:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions