Search Unity

How do I read data from the ECS to display on UI objects.

Discussion in 'Data Oriented Technology Stack' started by zanius, Feb 28, 2019.

  1. zanius

    zanius

    Joined:
    Feb 5, 2018
    Posts:
    16
    I'm making a resource bar at the top of the screen to display counts of different types of resources. I have a resource singleton component that has the data but I'm not sure of the best way to read this data from the monobehaviour script of my UI object. Right now in my resources system I'm setting the resources singleton entity as a static variable. Once I've done that I'm just finding the entitymanager and using GetComponentData from the static resource singleton entity in every update in the monobehaviour. This doesn't seem like the best way to do this.
     
  2. zanius

    zanius

    Joined:
    Feb 5, 2018
    Posts:
    16
    I actually just realized that a hybrid game object entity would achieve all of this perfectly, but I can't use a singleton component for it, which I suppose is fine. I'd still love anyone's input on this.
     
    learc83 likes this.
  3. MrCool92

    MrCool92

    Joined:
    Jul 13, 2015
    Posts:
    15
    Maybe you could have dirty flag and later on update everything that is dirty...?

    I'm also in a need of good UI - ECS data binding way...