Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  5. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

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

Discussion in 'Entity Component System and C# Job system' started by meanmonkey, Dec 5, 2018.

  1. meanmonkey

    meanmonkey

    Joined:
    Nov 13, 2014
    Posts:
    82
    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:
    785
    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:
    82
    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.