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. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Bug [ECS 0.9.0] Part of CompanionGameObjectUpdateSystem not working

Discussion in '2020.1 Beta' started by iamarugin, Apr 13, 2020.

  1. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    813
    The following code in CompanionGameObjectUpdateSystem doesn't work:
    Code (CSharp):
    1. var toDeactivate = Entities.WithAny<Disabled, Prefab>().WithAll<CompanionGameObjectActiveSystemState, CompanionLink>();
    2. toDeactivate.ForEach((CompanionLink link) => link.Companion.SetActive(false));
    3. EntityManager.RemoveComponent<CompanionGameObjectActiveSystemState>(toDeactivate.ToEntityQuery());
    because entities with Disabled or Prefab tag will not be included in entitiy query result. Adding .With(EntityQueryOptions.IncludeDisabled | EntityQueryOptions.IncludePrefab) to toDeactivate fixes this.
     
    Last edited: Apr 13, 2020
  2. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    813
    Sorry, wrong forum