Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

[SOLVED] Entity Batch Destroy & Create in single frame with same model + position is noticeable

Discussion in 'Data Oriented Technology Stack' started by meanmonkey, Dec 5, 2018.

  1. meanmonkey

    meanmonkey

    Joined:
    Nov 13, 2014
    Posts:
    99
    I have a custom / sectorbased lod system where I batch create & destroy using

    EntityManager.DestroyEntity(entityNativeArray1)
    EntityManager.CreateEntity(entityNativeArray2)

    in one single frame. For testing purpose, the models for each lod is exactly the same.

    The problem is, the gap between destroy and create is absolutley noticeable, to my confusion (meaning I see the old entity disappear and the new one (same model, same position) appearing with a blink).

    What is unity doing there under the hood? Is the spreading the batch create/destroy over multiple frames ?

    If yes, can I force somehow to do it in one frame?
     
    Last edited: Dec 5, 2018
  2. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,120
    I believe they are both instant, what if you try to place your EntityManager commands at a system positioned at UpdateBefore(Initialization)?
     
    meanmonkey likes this.
  3. meanmonkey

    meanmonkey

    Joined:
    Nov 13, 2014
    Posts:
    99
    As it turns out I shot too fast :D

    No problem with unity ecs at all, it was a system udpate order problem, specific to my own coding.

    So @5argon your idea was absolutely in the right direction, even if it wasn't UpdateBefore(Initialization), but a update order problem between my systems.
     
    5argon likes this.