Search Unity

What Am I Doing Wrong? Adding ConvertToEntity to a Cube and Disappearing upon Start.

Discussion in 'Entity Component System' started by Kmsxkuse, Jan 18, 2020.

  1. Kmsxkuse

    Kmsxkuse

    Joined:
    Feb 15, 2019
    Posts:
    306
    Package List:
    upload_2020-1-18_6-14-7.png

    I start up a brand new, fresh project.

    Spawn in a cube.

    Rotate the camera a bit to get the cube in view.

    Add ConvertToEntity to the cube.

    Cube disappears.

    Check Entity Debugger. Cube entity created. Cube position and size transfers correctly.

    Cube not there.

    Where did cube go?

    Please help. I've been trying to get the cube to show up for a couple hours now. My brain is fried.

    Edit: Removed Unity Physics. Cube is still gone. Why cube do you forsaken me?
     
    ScallyGames and nixiaozi like this.
  2. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    857
    add the Hybrid Renderer package
     
    ScallyGames, starikcetin and Kmsxkuse like this.
  3. Kmsxkuse

    Kmsxkuse

    Joined:
    Feb 15, 2019
    Posts:
    306
    Cameras dont work without Hybrid Renderer package. Geeeee Unity. Where was that in the documentation?

    Oh wait, there just isnt any documentation. Just the forums.

    Thanks man. That was a really simple fix and should be noted in bold letters somewhere in the package description.

    "Download these other packages to make your DOTS project function."
     
  4. EdRowlett-Barbu

    EdRowlett-Barbu

    Joined:
    Mar 16, 2015
    Posts:
    88
    In the converttoentity component, make sure you do "convert and inject" instead of "convert and destroy".
    But if you move the underlying entity, your cube won't move with it, so you might also want to use CopyTransformToGameObject component as well, so you can sync up the Translation/Rotation of the entity to the Transform of the original GameObject
     
    chrismarch likes this.
  5. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    To be fair the Entities package deal with only data and your cube did become data.. what to do with the data is up to you. It is just that Hybrid Renderer could render this data.

    You can use Entities for just data transformation so thats why renderer is not a dependency of Entities package.
     
  6. NoFuchsGavin

    NoFuchsGavin

    Joined:
    Sep 29, 2018
    Posts:
    5
    Same issue here.

    Why would you keep the game object here? This would introduce no performance gain, as you compute not only the ECS data now, but also have to move the data onto every gameobject by the sync adding more cache misses... am I right?

    Is added and configured like in several tutorials:




     
    Last edited: May 14, 2022