Search Unity

DisableRendering doesn't work on SpriteRenderer entity

Discussion in 'Project Tiny' started by Seaqqull, Oct 22, 2020.

  1. Seaqqull

    Seaqqull

    Joined:
    Aug 3, 2018
    Posts:
    23
    entityManager.RemoveComponent<DisableRendering>(entity);
    This code doesn't disable the rendering of the sprite entity.
     
  2. AbdulAlgharbi

    AbdulAlgharbi

    Unity Technologies

    Joined:
    Jul 27, 2018
    Posts:
    319
    Hi,
    What are you trying to achieve?
     
  3. Seaqqull

    Seaqqull

    Joined:
    Aug 3, 2018
    Posts:
    23
    Hello, I have different battles in the scene.
    If for instance the active battle number 1 I want to hide all other sprites that used in another battle.
    I think it could be achieved through loading (and unloading) sub-scenes via code, but I haven't found the way to do it :((
     
  4. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    383
    @Seaqqull have a look at how we show/hide certain UI groups in TinyGems/TinySpaceship (link). Adding the
    Disabled
    component to an entity allows it to not be picked up by the standard entity queries, this includes the rendering pipelines different queries. Removing the
    Disabled
    component later on, will restore the entity's state and let it be found by all entity queries again.
     
    Seaqqull likes this.
  5. Seaqqull

    Seaqqull

    Joined:
    Aug 3, 2018
    Posts:
    23
    Thank you for this response. I thought about just hiding some of the entities.
    Anyway, thank You.
     
    Ted_Wikman likes this.
unityunity