Search Unity

GetComponentGroup from another ECS World ???

Discussion in 'Entity Component System' started by NoDumbQuestion, Jan 25, 2019.

  1. NoDumbQuestion

    NoDumbQuestion

    Joined:
    Nov 10, 2017
    Posts:
    186
    I am trying to sync data between 2 World.
    1 world is Pure ECS net, another is Hybrid ECS (default one) have component to track Entity from Pure ECS world.
    The idea is have to Hybrid get data from Pure to update itself and put new data back to ECS world

    From this post, I try
    - Get EntityManager from each world then use SetComponentData(Entity) one by one work but it degrade as the list get bigger.
    - Share NativeArray between 2 world also work but still have lots of trouble logic to figure out.

    So I figure the best way to approach this is to have system get ComponentGroup directly from another system in different World.
    I set ComponentGroup to public and access from another system in diffrent World
    upload_2019-1-25_16-2-16.png
    It kinda work. But I now feel little worry if I do something not suppose to happen.

    Did ComponentGroup was designed this way? It allow us to access it globally as long it have the correct world?
     
    Last edited: Jan 25, 2019
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    I could be wrong, but I think at least the original intention of worlds was complete separation of data. They aren't really meant to communicate between each other. For example, a multiplayer server where each player is a separate world.

    There has been talk of other possible World usages more though. For example, in one talk a developer suggested that if worlds weren't locked to the update you could do async procedural generation in a secondary world before copying into the primary world.

    As it stands at the moment though, I'd recommend against using multiple worlds where they aren't required (again for example, a multiplayer server). The support just seems very limited at the moment.
     
    Last edited: Jan 25, 2019
    Flurgle likes this.
  3. NoDumbQuestion

    NoDumbQuestion

    Joined:
    Nov 10, 2017
    Posts:
    186
    Well I was used this with SpatialOS unity gdk. I guess the support isn't here.
    Kinda sad though.
     
  4. Azkron

    Azkron

    Joined:
    Oct 23, 2016
    Posts:
    5
  5. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    Last edited: Nov 16, 2019