diff --git a/Svelto.Common b/Svelto.Common
index 4b6f1b9..111fccb 160000
--- a/Svelto.Common
+++ b/Svelto.Common
@@ -1 +1 @@
-Subproject commit 4b6f1b9f9a08cbafc9e0a46a1ad7bf30eba10e9c
+Subproject commit 111fccbc4676ce1a5999570ca3c12f1918a9e763
diff --git a/Svelto.ECS/CheckEntityUtilities.cs b/Svelto.ECS/CheckEntityUtilities.cs
index 0b061f6..e85326b 100644
--- a/Svelto.ECS/CheckEntityUtilities.cs
+++ b/Svelto.ECS/CheckEntityUtilities.cs
@@ -1,4 +1,4 @@
-#if DEBUG && !PROFILER
+#if DEBUG && !PROFILE_SVELTO
using System.Collections.Generic;
using Svelto.DataStructures;
#else
@@ -7,9 +7,13 @@ using System.Diagnostics;
namespace Svelto.ECS
{
+ ///
+ /// Note: this check doesn't catch the case when an add and remove is done on the same entity before the next
+ /// submission. Two operations on the same entity are not allowed between submissions.
+ ///
public partial class EnginesRoot
{
-#if DEBUG && !PROFILER
+#if DEBUG && !PROFILE_SVELTO
void CheckRemoveEntityID(EGID egid)
{
// Console.LogError("removed".FastConcat(egid.ToString()));
@@ -48,14 +52,14 @@ namespace Svelto.ECS
.FastConcat("' id: '")
.FastConcat(egid.entityID)
.FastConcat("' groupid: '")
- .FastConcat(egid.groupID)
+ .FastConcat(egid.groupID)
.FastConcat("'"));
}
-
+
hash.Add(egid.entityID);
}
- void RemoveGroupID(ExclusiveGroup.ExclusiveGroupStruct groupID)
+ void RemoveGroupID(ExclusiveGroupStruct groupID)
{
_idCheckers.Remove(groupID);
}
@@ -73,7 +77,7 @@ namespace Svelto.ECS
}
[Conditional("_CHECKS_DISABLED")]
- void RemoveGroupID(ExclusiveGroup.ExclusiveGroupStruct groupID)
+ void RemoveGroupID(ExclusiveGroupStruct groupID)
{
}
#endif
diff --git a/Svelto.ECS/EntityBuilder.cs b/Svelto.ECS/ComponentBuilder.cs
similarity index 51%
rename from Svelto.ECS/EntityBuilder.cs
rename to Svelto.ECS/ComponentBuilder.cs
index 78aaffa..5b58344 100644
--- a/Svelto.ECS/EntityBuilder.cs
+++ b/Svelto.ECS/ComponentBuilder.cs
@@ -8,64 +8,19 @@ using Svelto.Utilities;
namespace Svelto.ECS
{
- public class EntityBuilder : IEntityBuilder where T : struct, IEntityStruct
+ public class ComponentBuilder : IComponentBuilder where T : struct, IEntityComponent
{
- static class EntityView
- {
- internal static readonly FasterList>> cachedFields;
- internal static readonly Dictionary cachedTypes;
-#if DEBUG && !PROFILER
- internal static readonly Dictionary> implementorsByType;
-#else
- internal static readonly Dictionary implementorsByType;
-#endif
- static EntityView()
- {
- cachedFields = new FasterList>>();
-
- var type = typeof(T);
-
- var fields = type.GetFields(BindingFlags.Public |
- BindingFlags.Instance);
-
- for (var i = fields.Length - 1; i >= 0; --i)
- {
- var field = fields[i];
-
- var setter = FastInvoke.MakeSetter(field);
-
- cachedFields.Add(new KeyValuePair>(field.FieldType, setter));
- }
-
- cachedTypes = new Dictionary();
-
-#if DEBUG && !PROFILER
- implementorsByType = new Dictionary>();
-#else
- implementorsByType = new Dictionary();
-#endif
- }
-
- internal static void InitCache()
- {}
-
- internal static void BuildEntityView(out T entityView)
- {
- entityView = new T();
- }
- }
-
- public EntityBuilder()
+ public ComponentBuilder()
{
_initializer = DEFAULT_IT;
- EntityBuilderUtilities.CheckFields(ENTITY_VIEW_TYPE, NEEDS_REFLECTION);
+ EntityBuilderUtilities.CheckFields(ENTITY_COMPONENT_TYPE, IS_ENTITY_VIEW_COMPONENT);
- if (NEEDS_REFLECTION)
- EntityView.InitCache();
+ if (IS_ENTITY_VIEW_COMPONENT)
+ EntityViewComponentCache.InitCache();
}
- public EntityBuilder(in T initializer) : this()
+ public ComponentBuilder(in T initializer) : this()
{
_initializer = initializer;
}
@@ -73,24 +28,23 @@ namespace Svelto.ECS
public void BuildEntityAndAddToList(ref ITypeSafeDictionary dictionary, EGID egid,
IEnumerable