You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a case in my code where I create and entity from a template during OnAdded in an EntitySystem. If you do this the new entity that is create never gets refreshed because it is currently in the middle of refreshing entities and afterwards it will clear the refresh list.
Simple Example
[Artemis.Attributes.ArtemisEntitySystem(ExecutionType = ExecutionType.Synchronous,GameLoopType = GameLoopType.Update, Layer = 1)]
public class SomeSystem : EntitySystem
{
public override void OnAdded(Entity entity)
{
base.OnAdded(entity);
GetEntityWorld().CreateEntityFromTemplate("SomeEnt", null); // this entity never gets refreshed
}
}
The text was updated successfully, but these errors were encountered:
I've created a pull request to partially fix this issue. The foreach loop isn't fixed because when you modify a collection during iteration it will throw an exception. I'm not sure why you have a foreach loop in there anyways as it will cause garbage collection and is actually slower than a standard for loop in this use case.
hmmm, i am seriously not happy with messaging in entity system, we had this discussion once a while ago and could not find an overall solution. My intention is to avoid any messaging while using Entity System (ES) if you can, it is not ideologic passable to its meaning in my opinion, because the "Message" should be a components data in ES. Event Messaging is therefore a paralell and dangerous way in combination with ES. You can do anything with ES, but mixing idiologics can do things more complicated as anyone can reproduce later. So if you can, avoid using events, use another component/system couple instead to get your messages transported.
I have a case in my code where I create and entity from a template during OnAdded in an EntitySystem. If you do this the new entity that is create never gets refreshed because it is currently in the middle of refreshing entities and afterwards it will clear the refresh list.
Simple Example
The text was updated successfully, but these errors were encountered: