fix creating new component index on every set
	
		
			
	
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
					Details
				
			
		
	
				
					
				
			
				
	
				continuous-integration/drone/push Build is passing
				
					Details
				
			
		
	
							parent
							
								
									98955f3048
								
							
						
					
					
						commit
						ffc052ded3
					
				|  | @ -50,10 +50,13 @@ namespace Encompass | |||
| 
 | ||||
|         private unsafe void InternalSet(int entityID, TComponent component) | ||||
|         { | ||||
|             var index = _idManager.NextID(); | ||||
|             if (!indices.ContainsKey(entityID)) | ||||
|             { | ||||
|                 indices[entityID] = _idManager.NextID(); | ||||
|             } | ||||
| 
 | ||||
|             var ptr = Unsafe.AsPointer(ref component); | ||||
|             indices[entityID] = index; | ||||
|             components[index] = Unsafe.AsRef<TComponent>(ptr); | ||||
|             components[indices[entityID]] = Unsafe.AsRef<TComponent>(ptr); | ||||
|         } | ||||
| 
 | ||||
|         public override bool Remove(int entityID, int priority) | ||||
|  | @ -84,6 +87,10 @@ namespace Encompass | |||
| 
 | ||||
|         public override void Clear() | ||||
|         { | ||||
|             foreach (var entityID in indices.Keys) | ||||
|             { | ||||
|                 _idManager.Free(entityID); | ||||
|             } | ||||
|             indices.Clear(); | ||||
|             priorities.Clear(); | ||||
|         } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue