Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Entities that reuse the same Entity index and version than an entity that was just created.

Discussion in 'Data Oriented Technology Stack' started by maxxa05, May 15, 2020.

  1. maxxa05

    maxxa05

    Joined:
    Nov 17, 2012
    Posts:
    118
    I got a weird bug where when I load a new scene with entities that get created with ConvertToEntity, previously created and destroyed entities' index and version gets reused. I check with EntityManager if an entity still exists and it returns true, and the entity it references is completely different from the one I checked originally.

    I would have thought that reused indexes would at least increment the version number, but the exact same version is reused. Anybody knows how that can happen and how to fix it?
     
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    1,662
    Do the entities belong to different worlds?
     
  3. maxxa05

    maxxa05

    Joined:
    Nov 17, 2012
    Posts:
    118
    No, I have only one World. One of the entities is created from scratch in a system and destroyed after a while, The other is created from a ConvertToEntity GameObject in a scene loaded additively. When I check in the entity debugger, the new entity gets linked from a field that is supposed to contain a previously destroyed entity. Both their Index and Version Numbers are the same.
     
  4. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    1,662
    Be more specific. There's a conversion world during GameObjectConversion that is separate from the destination world, and it is possible you are confusing the two in your conversion scripts.
     
  5. maxxa05

    maxxa05

    Joined:
    Nov 17, 2012
    Posts:
    118
    Well, I'm pretty sure they end up in the same World after the conversion. I use the default world generation, stuff gets generated by the GameObjectConversion, and when it gets converted it reuses the same Entity Index and Version from an entity that was just destroyed.
     
  6. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    591
    I guess u can submit bug report and post the case number at here.
     
unityunity