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. Dismiss Notice

ECS subscenes

Discussion in 'Entity Component System' started by DrBoum, Feb 20, 2022.

  1. DrBoum

    DrBoum

    Joined:
    Apr 19, 2020
    Posts:
    26
    hello, is it possible to opt out of subscene conversion for some specific gameobject ? id like to not convert some gameobject that are only for making edit easier
     
    Last edited: Feb 20, 2022
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,626
    Yes there's a component StopConvertToEntity
     
  3. DrBoum

    DrBoum

    Joined:
    Apr 19, 2020
    Posts:
    26
    it doesn't seems to have any effects in subscenes, it seems to only work for runtime conversion.
    adding stop convert:


    the entity that shouldn't have been converted:

     
    Last edited: Feb 20, 2022
  4. DrBoum

    DrBoum

    Joined:
    Apr 19, 2020
    Posts:
    26
    any other ideas @tertle ? anyone ?
     
  5. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    939
    Not sure that's advisable.
    If you choose not to convert some GO to entities what will happen when you close the sub scene ?
    I assume the editor will convert your subscenne to entities (without the excluded GO) and serialize it.
    But then how can it "restore" those GO ?? Once you reopen the subscene since the GO were not converted they were not serialized.
     
  6. DrBoum

    DrBoum

    Joined:
    Apr 19, 2020
    Posts:
    26
    i only wish to not have the entity representation of those GameObject that are purely here for my editing need in the gameobject scene, of course i wish to keep those GameObject around
     
  7. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    939
    In that case the only thing I can think of is to have a tag component for those and have a system that destroy/disable any entity with that component.
    If you put a AlwaysUpdateSystem attribute on that system I expect it would run in editor and destroy/disable any entities that are converted when closing the subscene. Since the destruction happens at "runtime" it should not affect the subscene serialization process.
    Note that this won't prevent these "unwanted" entities to be part of the built product.

    But like I said, I don't see a way to prevent the convertion to an entity without losing the gameobject after deserialization.
     
  8. DrBoum

    DrBoum

    Joined:
    Apr 19, 2020
    Posts:
    26
    ive attempted to destroy the entities generated with a tag but i got plenty of errors because the linkedgroup/DOTS animation conversion systems expects those entities to be valid, so i am looking for something similar to the "StopConvertToEntity" behaviour but that works with subscenes.
    thanks for your answer @WAYN_Games