thelinuxlich / artemis_CSharp

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

Defer AddComponent until the end of the current entity system. #85

Closed graphnode closed 9 years ago

graphnode commented 9 years ago

Basically the same as RemoveComponent and Delete for Entity.

If a component is added to an entity, and that component is used on the current system, the processing crashes since the enumeration changed.

I'll see if I can fix it and make a pull request.

KellanHiggins commented 9 years ago

Would this affect me adding a component and immediately using it to add data to it?

I've also being using Artemis for about a year and haven't run into this issue. How did you find this issue?

graphnode commented 9 years ago

@KellanHiggins

To fix this we would add the entity to the component bag after the processing ends.

It should not affect using the component or adding data since it would only delay the processing of the new entity until the next iteration.

I found this issue after making an entity duplicate itself in the processing method with the same components (and different values).

KellanHiggins commented 9 years ago

Yup, sounds good to me! I do run into null error issues often when running parallel processing different Entity Processing Systems.

KellanHiggins commented 9 years ago

Looks like someone with a fork already did this by the way (was just looking at other people's version of this) https://github.com/Mephistofeles/artemis_CSharp/commit/e8f02450467c935bc4f3c9556f1ad05651d24d0d.

Mephistofeles commented 9 years ago

Yes, the pull request is still opened. @Maximusya said he's working on it, but that was about half a year ago.

KellanHiggins commented 9 years ago

Anyone know if @Maximusya is still active on Artemis? I haven't seen him comment on anything in a while.

tpastor commented 9 years ago

I dont know ! Anyway, i think that this fix is necessary and we should merge with Mephistofeles@e8f0245 correction

KellanHiggins commented 9 years ago

Any reason that this was closed or no one was doing anything on it?