thelinuxlich / artemis_CSharp

Artemis Entity System Framework ported to C#
Other
341 stars 78 forks source link

Collection was modified when creating entities inside system loop. #63

Closed Mephistofeles closed 10 years ago

Mephistofeles commented 10 years ago

I cannot create entity in entity system during processing, if that entity has components required by the system. It's caused by

this.Refresh(entity);

in EntityManager.cs while adding or removing components. I don't know if it's a design decision, but if not I suggest changing this to

this.entityWorld.RefreshEntity(entity);

This way it won't modify collection before the next update.

tpastor commented 10 years ago

I think this can be useful ! This change break unit tests ? Have you tried to implement this?

Enviado via iPhone

Em 10/02/2014, às 20:51, Mephistofeles notifications@github.com escreveu:

I cannot create entity in entity system during processing, if that entity has components required by the system. It's caused by

this.Refresh(entity); in EntityManager.cs while adding or removing components. I don't know if it's a design decision, but if not I suggest changing this to

this.entityWorld.RefreshEntity(entity); This way it won't modify collection before the next update.

— Reply to this email directly or view it on GitHub.

Mephistofeles commented 10 years ago

I changed the file, test passed. I submitted a pull request.