Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

### Disable/Enable entities in closed Subscene by a job or c# code ###

Discussion in 'Entity Component System' started by Quatum1000, May 5, 2020.

  1. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Hi everyone,

    I urgently search for a solution to enable/disable specified entities in closed Subscene by c# code/job.
    Subscenes are loaded by the entitymanger itself. I think indices are unpredictable.

    I thought about to add a custom value to the specified entities before closing the Subscene. And hope the custom value is carried with the closed Subscenes... If the Subscene is closed, then iterate over the complete EM entities, try to find it, then poke any max float value to the transform matrix to mark it invisible for render loop.

    I know it's an ugly solution to iterate over all the entities, but direct indexing seems to be impossible.

    What do you think? Should this work,or does anyone have another idea?

    Thanks a lot !
     
  2. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889