Explorar o código

RemoveComponent会调用GetComponent,结果触发了GetComponentSystem,这是不合理的

tanghai %!s(int64=2) %!d(string=hai) anos
pai
achega
f621f2539c
Modificáronse 1 ficheiros con 7 adicións e 6 borrados
  1. 7 6
      Unity/Assets/Scripts/Core/Entity/Entity.cs

+ 7 - 6
Unity/Assets/Scripts/Core/Entity/Entity.cs

@@ -591,8 +591,9 @@ namespace ET
             }
 
             Type type = typeof (K);
-            Entity c = this.GetComponent(type);
-            if (c == null)
+            
+            Entity c;
+            if (!this.components.TryGetValue(type.FullName, out c))
             {
                 return;
             }
@@ -613,8 +614,8 @@ namespace ET
                 return;
             }
 
-            Entity c = this.GetComponent(component.GetType());
-            if (c == null)
+            Entity c;
+            if (!this.components.TryGetValue(component.GetType().FullName, out c))
             {
                 return;
             }
@@ -635,8 +636,8 @@ namespace ET
                 return;
             }
 
-            Entity c = this.GetComponent(type);
-            if (c == null)
+            Entity c;
+            if (!this.components.TryGetValue(type.FullName, out c))
             {
                 return;
             }