I'm not new to coding, or to Unity for that matter, but I am fairly new to the ECS pattern. I've been getting my feet wet with it, and seem to be getting on okay. I understand that components store data, which are then 'tagged' to an Entity. Systems can then be developed to interact and respond with these components and entities. So far, so good. I have however hit a bit of a mental wall when I have a very simple AI. For all intents and purposes, let's say we have an Entity, with an Enemy Component (simply used to tag that this Entity is an enemy), a Health Component and the usual transform components (Translation, Rotation etc.). Now let's say we have another Entity with a Player Component (again, just a tag), along with Health Component and the usual suspects. I've been struggling to think of the most pure ECS way of simply having a system whereby the Enemy Entity can "look" for players within a certain range. If you get within, say 10 units, of the enemy, an "AttackPlayer" component can be send to the Enemy Entity and off it goes. The tricky bit for me, mentally, is the spacial awareness of the AI. If there is only one player, this is trivial, have a system pull every EnemyComponent, along with the enemies Translation then compare that position to the player's position. But let's say the player can control lots of units, say, 1000 units. This could become a problem - we can't just pull 1000 Enemies, then for each of those compare to each of the 1000 Player units. Standard O(N) Alternatively, I could take all the entities I want to query and build a tree of some sort, like a quad tree, every frame. I could then use a system to populate the quad tree (maybe pull all entities with Translation and maybe a "TargetableComponent"), and other systems can use that quadtree to query for nearby entities. This doesn't feel like the right solution to the problem, but maybe I'm just misunderstanding something. Is there any tips anyone has for solving this problem? Thanks in advance!