From 081dde24b00cb01c017b4c6b500d829b039a785d Mon Sep 17 00:00:00 2001 From: sebas77 Date: Tue, 19 Jun 2018 09:30:10 +0100 Subject: [PATCH] add comment and rename function --- Svelto.ECS/DataStructures/TypeSafeDictionary.cs | 4 ++-- Svelto.ECS/EnginesRoot.Submission.cs | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Svelto.ECS/DataStructures/TypeSafeDictionary.cs b/Svelto.ECS/DataStructures/TypeSafeDictionary.cs index da62807..00480be 100644 --- a/Svelto.ECS/DataStructures/TypeSafeDictionary.cs +++ b/Svelto.ECS/DataStructures/TypeSafeDictionary.cs @@ -70,11 +70,11 @@ namespace Svelto.ECS.Internal { TValue entity = values[i]; - AddEntityViewFromEngines(entityViewEnginesDB, ref entity); + AddEntityViewToEngines(entityViewEnginesDB, ref entity); } } - void AddEntityViewFromEngines(Dictionary> entityViewEnginesDB, ref TValue entity) + void AddEntityViewToEngines(Dictionary> entityViewEnginesDB, ref TValue entity) { FasterList entityViewsEngines; //get all the engines linked to TValue diff --git a/Svelto.ECS/EnginesRoot.Submission.cs b/Svelto.ECS/EnginesRoot.Submission.cs index 3b6ce38..5a9cac1 100644 --- a/Svelto.ECS/EnginesRoot.Submission.cs +++ b/Svelto.ECS/EnginesRoot.Submission.cs @@ -23,6 +23,12 @@ namespace Svelto.ECS //current will be use to write new entityViews _groupedEntityToAdd.Swap(); + //Note: if N entity of the same type are added on the same frame + //the Add callback is called N times on the same frame. + //if the Add calback builds a new entity, that entity will not + //be available in the database until the N callbacks are done + //solving it could be complicated as callback and database update + //must be interleaved. if (_groupedEntityToAdd.other.Count > 0) AddEntityViewsToTheDBAndSuitableEngines(_groupedEntityToAdd.other);