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

Feedback Part of CompanionGameObjectUpdateSystem not working

Discussion in 'Entity Component System' started by iamarugin, Apr 13, 2020.

  1. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    863
    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.
     
    odolotov, volume9 and LevonVH like this.
  2. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    863
  3. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    863
    Also EntityManager.Instantiate(entity) where entity is a prefab with Hybrid components fails with the folowing stacktrace.

    Code (CSharp):
    1. ArgumentException: The given container was null. Visitation only works for valid non-null containers.
    2. Unity.Properties.PropertyContainer.Visit[TContainer] (TContainer& container, Unity.Properties.Internal.IVisitor visitor, Unity.Properties.VisitParameters parameters) (at Library/PackageCache/com.unity.properties@1.1.0-preview/Runtime/Unity.Properties/Algorithms/PropertyContainer.Visit.cs:120)
    3. Unity.Properties.PropertyContainer.Visit (System.Object container, Unity.Properties.PropertyVisitor visitor, Unity.Properties.VisitParameters parameters) (at Library/PackageCache/com.unity.properties@1.1.0-preview/Runtime/Unity.Properties/Algorithms/PropertyContainer.Visit.cs:53)
    4. Unity.Entities.EntityRemapUtility.PatchEntityForPrefabInBoxedType (System.Object container, Unity.Entities.Entity* remapSrc, Unity.Entities.Entity* remapDst, System.Int32 remapInfoCount) (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/EntityRemapUtility.cs:298)
    5. Unity.Entities.ManagedComponentStore.PatchEntitiesForPrefab (System.Int32* managedComponents, System.Int32 numManagedComponents, System.Int32 allocatedCount, System.Int32 remappingCount, Unity.Entities.Entity* remapSrc, Unity.Entities.Entity* remapDst) (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/ManagedComponentStore.cs:598)
    6. Unity.Entities.ManagedComponentStore.Playback (Unity.Entities.ManagedDeferredCommands& managedDeferredCommands) (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/ManagedComponentStore.cs:664)
    7. EntityDataAccess.PlaybackManagedChanges () (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/EntityDataAccess.cs:642)
    8. EntityDataAccess.InstantiateInternal (Unity.Entities.Entity srcEntity, Unity.Entities.Entity* outputEntities, System.Int32 count) (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/EntityDataAccess.cs:794)
    9. Unity.Entities.EntityManager.Instantiate (Unity.Entities.Entity srcEntity) (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/EntityManagerCreateDestroyEntities.cs:185)
    10. Orbit.ShipAndCoSpawnerSystem.OnUpdate (Unity.Jobs.JobHandle inputDeps) (at Assets/Tmp/TestSysem.cs:24)
    11. Unity.Entities.JobComponentSystem.Update () (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/JobComponentSystem.cs:129)
    12. Unity.Entities.ComponentSystemGroup.UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/ComponentSystemGroup.cs:134)
    13. UnityEngine.Debug:LogException(Exception)
    14. Unity.Debug:LogException(Exception) (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/Stubs/Unity/Debug.cs:19)
    15. Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/ComponentSystemGroup.cs:138)
    16. Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/ComponentSystemGroup.cs:114)
    17. Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/ComponentSystem.cs:108)
    18. Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/ScriptBehaviourUpdateOrder.cs:200)
    19.  
     
  4. Fabrice_Lete

    Fabrice_Lete

    Unity Technologies

    Joined:
    May 5, 2018
    Posts:
    47
    Good find, thanks for reporting! I'm having a look.
     
  5. LevonVH

    LevonVH

    Joined:
    Dec 16, 2016
    Posts:
    13
    Very annoying problem. I am too waiting for a fix.
     
    nicolasgramlich, odolotov and volume9 like this.
  6. MeepMeep33

    MeepMeep33

    Joined:
    Jul 5, 2018
    Posts:
    9
    Any update on this issue? I'm trying to attach particles to a projectile this way.
     
  7. Fabrice_Lete

    Fabrice_Lete

    Unity Technologies

    Joined:
    May 5, 2018
    Posts:
    47
    A series of issues related to this have been fixed in 0.10 but the specific one you ran into with the particles is still open. But I have identified the cause and I have a fix, I'm expecting to land this for next release.

    For info, what triggers the issue is to instantiate a prefab that has several hybrid components.
     
    Srokaaa likes this.
  8. Srokaaa

    Srokaaa

    Joined:
    Sep 18, 2018
    Posts:
    169
  9. Fabrice_Lete

    Fabrice_Lete

    Unity Technologies

    Joined:
    May 5, 2018
    Posts:
    47
    That's exactly it indeed, thanks! I've fixed it and the code is in review, pretty sure it'll be part of the next release.
     
    Srokaaa likes this.
  10. Fabrice_Lete

    Fabrice_Lete

    Unity Technologies

    Joined:
    May 5, 2018
    Posts:
    47
    For a little bit of extra info, the error that iamaruginm ran into was a corruption of the managed component store during prefab instantiation, but the function where the argument exception triggered wasn't even supposed to be called (combo!). What Srokaaa ran into is that the function that shouldn't be called doesn't exist at all in IL2CPP builds.
     
    Srokaaa likes this.
  11. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    863
    Thanks for fixes and info!
     
  12. nicolasgramlich

    nicolasgramlich

    Joined:
    Sep 21, 2017
    Posts:
    231
    Thanks for the update. Is there an eta on this?
     
  13. nicolasgramlich

    nicolasgramlich

    Joined:
    Sep 21, 2017
    Posts:
    231
    Similar (or same) issue for TrailRenderer on Android builds with
    0.10.0-preview.6
    , while the Editor builds are fine:
    https://forum.unity.com/threads/hybridcomponent-breaks-in-build.879916/#post-5797006

    Summarizing:
    Multiple HybridComponents (I.e. ParticleSystem + ParticleSystemRenderer via AddHybridComponent) -> Fails in Editor
    Single HybridComponents (I.e. TrailRenderer) -> Fails on Android, Works in Editor
     
  14. Fabrice_Lete

    Fabrice_Lete

    Unity Technologies

    Joined:
    May 5, 2018
    Posts:
    47
    The fix that addresses both issues is now on master, and is part of the branch off for 0.11 so it will be for sure in the next package release. ETA end of this week.
     
    Tony_Max, Hanoke, eizenhorn and 3 others like this.
  15. nicolasgramlich

    nicolasgramlich

    Joined:
    Sep 21, 2017
    Posts:
    231
    Awesome, thanks!!! :cool::):D
     
  16. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    863
    Thanks!
     
  17. surits14

    surits14

    Joined:
    Jan 22, 2018
    Posts:
    22
    @Fabrice_Lete
    I get a similar error report but this is related to the prefab entity conversion.

    Code (CSharp):
    1. ArgumentException: The given container was null. Visitation only works for valid non-null containers.
    2. Unity.Properties.PropertyContainer.Visit[TContainer] (TContainer& container, Unity.Properties.Internal.IVisitor visitor, Unity.Properties.VisitParameters parameters) (at Library/PackageCache/com.unity.properties@1.1.1-preview/Runtime/Unity.Properties/Algorithms/PropertyContainer.Visit.cs:120)
    3. Unity.Properties.PropertyContainer.Visit (System.Object container, Unity.Properties.PropertyVisitor visitor, Unity.Properties.VisitParameters parameters) (at Library/PackageCache/com.unity.properties@1.1.1-preview/Runtime/Unity.Properties/Algorithms/PropertyContainer.Visit.cs:53)
    4. Unity.Entities.EntityRemapUtility.PatchEntityForPrefabInBoxedType (System.Object container, Unity.Entities.Entity* remapSrc, Unity.Entities.Entity* remapDst, System.Int32 remapInfoCount) (at Library/PackageCache/com.unity.entities@0.10.0-preview.6/Unity.Entities/EntityRemapUtility.cs:298)
    5. Unity.Entities.ManagedComponentStore.PatchEntitiesForPrefab (System.Int32* managedComponents, System.Int32 numManagedComponents, System.Int32 allocatedCount, System.Int32 remappingCount, Unity.Entities.Entity* remapSrc, Unity.Entities.Entity* remapDst) (at Library/PackageCache/com.unity.entities@0.10.0-preview.6/Unity.Entities/ManagedComponentStore.cs:598)
    6. Unity.Entities.ManagedComponentStore.Playback (Unity.Entities.ManagedDeferredCommands& managedDeferredCommands) (at Library/PackageCache/com.unity.entities@0.10.0-preview.6/Unity.Entities/ManagedComponentStore.cs:664)
    7. Unity.Entities.EntityDataAccess.PlaybackManagedChanges () (at Library/PackageCache/com.unity.entities@0.10.0-preview.6/Unity.Entities/EntityDataAccess.cs:760)
    8. Unity.Entities.EntityDataAccess.InstantiateInternal (Unity.Entities.Entity srcEntity, Unity.Entities.Entity* outputEntities, System.Int32 count) (at Library/PackageCache/com.unity.entities@0.10.0-preview.6/Unity.Entities/EntityDataAccess.cs:900)
    9. Unity.Entities.EntityManager.Instantiate (Unity.Entities.Entity srcEntity) (at Library/PackageCache/com.unity.entities@0.10.0-preview.6/Unity.Entities/EntityManagerCreateDestroyEntities.cs:196)
    10. Spaceship_Entity.Start () (at Assets/Resources/Scripts/Spaceship/Spaceship_Entity.cs:82)
    11.  
    I did not have this issue previously. Only after I added HYBRID_ENTITIES_CAMERA_CONVERSION to the Scripting Define Symbol in the Android Player settings I get this error. If I remove the symbol I do not get this error.

    I am using the latest version of Entities Package in Unity 2019.3.10f1

    Thank you.
     
  18. zardini123

    zardini123

    Joined:
    Jan 5, 2013
    Posts:
    68
    I too have the error in my development builds: No PropertyBag was found for Type=[UnityEngine.VFX.VisualEffect]. Please make sure all types are declared ahead of time using [GeneratePropertyBagAttribute]

    I see that Entities 0.11 has not been released yet. Is there a new ETA?
     
  19. nicolasgramlich

    nicolasgramlich

    Joined:
    Sep 21, 2017
    Posts:
    231
    Tony_Max and florianhanke like this.