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

How to check if entity still exists in a job?

Discussion in 'Entity Component System' started by davenirline, Mar 28, 2019.

  1. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    948
    I want the equivalent of EntityManager.Exists() that can be used inside job structs. What can I use?
     
  2. Attatekjir

    Attatekjir

    Joined:
    Sep 17, 2018
    Posts:
    23
    Pass a ComponentDataFromEntity<T> to the job and you can check ComponentDataFromEntity.Exists(entity) if you know that if the entity exists it should have component T.
     
  3. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    I don't think you can really know if the entity exists inside a job.
    There are other options depending on your use case.