Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question In the ECS system, is an Entity the primary basis for querying unit information? (the most Optimal)

Discussion in 'Entity Component System' started by Bagazi, Aug 22, 2023.

  1. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    609
    There is a game scenario where units can shoot arrows at target units, and once the arrow is fired, its orientation changes based on the target unit's position. I'm thinking of having an Entity object within the Arrow's Component to represent the target unit. Additionally, I assume using a MoveSystem to manage unit movement. Within this MoveSystem, I would determine the arrow's flight direction based on the position of the arrow's target object (retrieved through its own target Entity object). Is this design appropriate?


    Furthermore, when considering the entire game scene (with many units capable of moving), is it suitable to have a single MoveSystem to handle this?
     
  2. msfredb7

    msfredb7

    Joined:
    Nov 1, 2012
    Posts:
    143
    The design seems appropriate.

    However, I don't think unit movement and arrow "seeking" should be updated in the same system, simply because they are two different behaviors in my mind.
     
    Bagazi likes this.