Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Showing and hiding entities

Discussion in 'Entity Component System' started by DenizCetinalp, Oct 13, 2018.

  1. DenizCetinalp

    DenizCetinalp

    Joined:
    Feb 8, 2014
    Posts:
    16
    Previously iv'e been hiding entities by removing the TransformMatrix component from the entity, and showing them again by adding the TransformMatrix back to the entity.

    I just updated the ecs package to the latest version (0.0.12 prev 18), and TransformMatrix is now LocalToWorld, however removing the LocalToWorld component from the entity does not hide the entity.

    Instead of removing/adding the LocalToWorld component, I tried with the MeshInstanceRenderer component, which seems to be working. Im wondering if there is a better/proper way of toggling entities. I've already compared performance with destroying/creating entities, which is quite a bit more costly, so I don't want to go down that approach.
     
  2. pcysl5edgo

    pcysl5edgo

    Joined:
    Jun 3, 2018
    Posts:
    65
    Use Disabled component.
     
  3. j0s3I0p3z

    j0s3I0p3z

    Joined:
    Sep 10, 2017
    Posts:
    3
    @pcysl5edgo. Could you please elaborate a bit more? I am also trying to do the same thing. Thanks!
     
  4. dartriminis

    dartriminis

    Joined:
    Feb 3, 2017
    Posts:
    157
    An entity with the Disabled component is ignored by all system updates.