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

Official Entities 0.17 changelog

Discussion in 'Entity Component System' started by Brian_Will, Dec 10, 2020.

  1. Timboc

    Timboc

    Joined:
    Jun 22, 2015
    Posts:
    238
    Quick overview of first things you may hit that I would have liked to be aware of (please correct any inaccuracies- this is from an hr of checking out new packages):
    -Methods to get existing struct systems from within a system (ISBs) are internal
    -No lambda, ISCD/filtering or ECB support
    -Not possible to fetch an ISB from entitymanager etc
    -cryptic errors that don’t point to useful lines*
    This makes it very difficult to convert anything of any complexity or with any dependencies. Appreciate it’s early days and likely why those methods are internal and subject to change.
    I’m also suffering a major issue with jobs that have queries that don’t match any entities taking up 1000x more time than they were previously but hopefully that’s a bug on my end that’s been highlighted by the update somehow.
    *eg
    (0,0): Burst error BC1042: The managed class type `System.IntPtr` is not supported. Loading from a non-readonly static field `Unity.Jobs.IJobExtensions.JobStruct`1<Unity.Collections.LowLevel.Unsafe.UnsafeDisposeJob>.jobReflectionData` is not supported
    that pointed to an empty line and seemed to be related to IJobEntityBatch (swapped it for IJobChunk and error went away). Also pretty much any error related to erroneous use of managed didn’t have useful info either.
     
    Last edited: Jan 22, 2021
    Sarkahn, Lukas_Kastern and MartijnGG like this.
  2. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    954
    I'm getting this error in 0.17, thrown every frame:
    Code (CSharp):
    1. InvalidProgramException: Passing an argument of size '10720'.
    2. Unity.Entities.SystemBase.Update () (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/SystemBase.cs:412)
    Seems pretty generic. Not sure where it really comes from.
     
  3. BigRookGames

    BigRookGames

    Joined:
    Nov 24, 2014
    Posts:
    330
    I am having an issue with the default world not getting initialized, it seems to be failing during defaultworldinitialization.cs at m_Unmanaged.Create(this, flags);

    Is there anything different that must be done to allow for proper initialization of the default world?
     
  4. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    upload_2021-1-23_12-36-22.png

    That just seems to be the catch for from your SystemBase Update.
    A quick google seems this has popped up here and there from the NetCode package. Might be worth clearing and running your codegen again.
     
  5. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    954
    It's a NetCode project indeed. Sadly no luck with codegen. Output is identical.
    The deeper issue is with a too large struct from what I could gather. The question is, how to find out which one and why is it a problem now and not in 0.16.

    edit: Upgrading to NetCode 0.6 fixed the problem. Still interested what it was. :)
     
    Last edited: Jan 23, 2021
  6. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    So ah. What's the trick to make ISystemBase.OnUpdate burst compile? Because mine are definitely not
     
    Last edited: Jan 23, 2021
  7. Sarkahn

    Sarkahn

    Joined:
    Jan 9, 2013
    Posts:
    440
    You have to add [BurstCompile] to both the struct and the function
     
  8. desertGhost_

    desertGhost_

    Joined:
    Apr 12, 2018
    Posts:
    259
    I'm having the same issue.

    I tried that, but I when I try to schedule a job I get an error about IntPtr not being burstable.
     
  9. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    OK so I was doing that and getting the same error as desertGhost. After testing more what I'm finding is this is caused by scheduling jobs in ISystemBase... which I thought was meant to be supported?

    If you can't schedule jobs it kind of defaults a lot of the purpose of this for me (it is fast at least though)
     
    desertGhost_ and PublicEnumE like this.
  10. Sarkahn

    Sarkahn

    Joined:
    Jan 9, 2013
    Posts:
    440
    So I set up a small test scene earlier:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using Unity.Entities;
    4. using Unity.Rendering;
    5.  
    6. using Unity.Jobs;
    7. using Unity.Transforms;
    8. using Unity.Burst;
    9.  
    10. public struct SharedComponent : ISharedComponentData
    11. {
    12.     public int value;
    13.     public static implicit operator int(SharedComponent b) => b.value;
    14.     public static implicit operator SharedComponent(int v) =>
    15.         new SharedComponent { value = v };
    16. }
    17.  
    18. [BurstCompile]
    19. public struct StructSystem : ISystemBase
    20. {
    21.     EntityQuery _eq;
    22.  
    23.     public void OnCreate(ref SystemState state)
    24.     {
    25.         _eq = state.GetEntityQuery(typeof(Translation), typeof(SharedComponent));
    26.         _eq.SetSharedComponentFilter<SharedComponent>(1);
    27.     }
    28.  
    29.     public void OnDestroy(ref SystemState state)
    30.     {
    31.     }
    32.  
    33.     [BurstCompile]
    34.     public void OnUpdate(ref SystemState state)
    35.     {
    36.         state.Dependency = new J
    37.         {
    38.             translationHandle = state.GetComponentTypeHandle<Translation>(false),
    39.             dt = state.Time.DeltaTime,
    40.             val = 10
    41.         }.ScheduleParallel(_eq, state.Dependency);
    42.     }
    43. }
    44.  
    45. [BurstCompile]
    46. struct J : IJobChunk
    47. {
    48.     public ComponentTypeHandle<Translation> translationHandle;
    49.     public float dt;
    50.     public int val;
    51.  
    52.     public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex)
    53.     {
    54.         var translations = chunk.GetNativeArray(translationHandle);
    55.  
    56.         for(int i = 0; i < chunk.Count; ++i)
    57.         {
    58.             var t = translations[i];
    59.             t.Value += 1 * dt;
    60.             translations[i] = t;
    61.         }
    62.     }
    63. }
    This appears to work fine - everything is bursted, and it does move a cube around. Someone on the discord said they had that IntPtr error from trying to schedule a job with the new native list filter feature - seems like that might be broken at least.

    As mentioned above we unfortunately still can't use shared components in jobs, and we can't even set a shared component filter on an entity query in a bursted OnUpdate.
     
  11. desertGhost_

    desertGhost_

    Joined:
    Apr 12, 2018
    Posts:
    259
    I think that ISystemBase might be a more or less a foundational addition in this release?

    EDIT:

     
  12. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    Summary:
    IJob - doesn't work
    IJobParallelFor - doesn't work
    IJobEntityBatch - doesn't work
    IJobChunk - works

    Tests:

    OK so IJobEntityBatch doesn't seem to work

    Code (CSharp):
    1. [BurstCompile]
    2. public struct UnmanagedISystemBaseTest : ISystemBase
    3. {
    4.     private EntityQuery _query;
    5.  
    6.     public void OnCreate(ref SystemState state)
    7.     {
    8.         this._query = state.GetEntityQuery(typeof(Translation));
    9.     }
    10.  
    11.     public void OnDestroy(ref SystemState state)
    12.     {
    13.     }
    14.  
    15.     [BurstCompile]
    16.     public void OnUpdate(ref SystemState state)
    17.     {
    18.         state.Dependency = new TestJob().ScheduleParallel(_query, 1, state.Dependency);
    19.     }
    20. }
    21.  
    22. [BurstCompile]
    23. public struct TestJob : IJobEntityBatch
    24. {
    25.     public void Execute(ArchetypeChunk batchInChunk, int batchIndex)
    26.     {
    27.     }
    28. }
    IJob doesn't seem to work

    Code (CSharp):
    1. [BurstCompile]
    2. public struct UnmanagedISystemBaseTest : ISystemBase
    3. {
    4.     public void OnCreate(ref SystemState state)
    5.     {
    6.     }
    7.  
    8.     public void OnDestroy(ref SystemState state)
    9.     {
    10.     }
    11.  
    12.     [BurstCompile]
    13.     public void OnUpdate(ref SystemState state)
    14.     {
    15.         state.Dependency = new TestJob().Schedule(state.Dependency);
    16.     }
    17. }
    18.  
    19. [BurstCompile]
    20. public struct TestJob : IJob
    21. {
    22.     public void Execute()
    23.     {
    24.     }
    25. }
    However IJobChunk does seem to work

    Code (CSharp):
    1. [BurstCompile]
    2. public struct UnmanagedISystemBaseTest : ISystemBase
    3. {
    4.     private EntityQuery _query;
    5.  
    6.     public void OnCreate(ref SystemState state)
    7.     {
    8.         this._query = state.GetEntityQuery(typeof(Translation));
    9.     }
    10.  
    11.     public void OnDestroy(ref SystemState state)
    12.     {
    13.     }
    14.  
    15.     [BurstCompile]
    16.     public void OnUpdate(ref SystemState state)
    17.     {
    18.         state.Dependency = new TestJob().ScheduleParallel(_query, state.Dependency);
    19.     }
    20. }
    21.  
    22. [BurstCompile]
    23. public struct TestJob : IJobChunk
    24. {
    25.     public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex)
    26.     {
    27.     }
    28. }
    IJobParallelFor does not seem to work

    Code (CSharp):
    1. [BurstCompile]
    2. public struct UnmanagedISystemBaseTest : ISystemBase
    3. {
    4.     public void OnCreate(ref SystemState state)
    5.     {
    6.     }
    7.  
    8.     public void OnDestroy(ref SystemState state)
    9.     {
    10.     }
    11.  
    12.     [BurstCompile]
    13.     public void OnUpdate(ref SystemState state)
    14.     {
    15.         state.Dependency = new TestJob().Schedule(10, 10, state.Dependency);
    16.     }
    17. }
    18.  
    19. [BurstCompile]
    20. public struct TestJob : IJobParallelFor
    21. {
    22.     public void Execute(int index)
    23.     {
    24.     }
    25. }
    26.  
     
    Timboc and Sarkahn like this.
  13. Sarkahn

    Sarkahn

    Joined:
    Jan 9, 2013
    Posts:
    440
    My personal feedback - I probably won't use these until we can use a ForEach or some other typing-reducing equivalent in there. My poor wrists just can't handle typing out so much boilerplate.
     
    NotaNaN and lclemens like this.
  14. desertGhost_

    desertGhost_

    Joined:
    Apr 12, 2018
    Posts:
    259
    Leaning towards the same thing. I really prefer ForEach for most things. Although I have to say the speed of it is tempting.
     
  15. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    851
    batch(and chunk in a real system) seem to work for me

    Code (CSharp):
    1. public struct TestSBSystem : ISystemBase
    2.     {
    3.         private EntityQuery query;
    4.  
    5.         public void OnCreate(ref SystemState state)
    6.         {
    7.             query = state.GetEntityQuery(typeof(Translation));
    8.         }
    9.  
    10.         public void OnDestroy(ref SystemState state)
    11.         {
    12.         }
    13.  
    14.         [BurstCompile]
    15.         public void OnUpdate(ref SystemState state)
    16.         {
    17.             int batchesPerChunk = 14;
    18.             state.Dependency = new BatchJob
    19.             {
    20.                 TranslationTypeHandle = state.GetComponentTypeHandle<Translation>(),
    21.                 EntityTypeHandle      = state.GetEntityTypeHandle()
    22.             }.ScheduleParallel(query, batchesPerChunk, state.Dependency);
    23.         }
    24.  
    25.  
    26.         [BurstCompile]
    27.         private struct BatchJob : IJobEntityBatch
    28.         {
    29.             public            ComponentTypeHandle<Translation> TranslationTypeHandle;
    30.             [ReadOnly] public EntityTypeHandle                 EntityTypeHandle;
    31.  
    32.             public void Execute(ArchetypeChunk batchInChunk, int batchIndex)
    33.             {
    34.                 //if(batchInChunk.Count<1)
    35.                 //return;
    36.                 var entities     = batchInChunk.GetNativeArray(EntityTypeHandle);
    37.                 var translations = batchInChunk.GetNativeArray(TranslationTypeHandle);
    38.  
    39.                 for (int i = 0; i < translations.Length; i++)
    40.                 {
    41.                     var entity      = entities[i];
    42.                     var translation = translations[i];
    43.  
    44.                     translation.Value += new float3(0, 1, 0);
    45.  
    46.                     translations[i] = translation;
    47.                 }
    48.             }
    49.         }
    50.     }
     
  16. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    Interesting code is pretty much the same except mine wasn't doing anything. What version of Burst and Unity Editor?

    -edit-

    oh, you're missing [BurstCompile] from the system declaration. It won't burst compile without it.

    [BurstCompile]
    public struct TestSBSystem : ISystemBase
     
  17. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    851
    ahhh now Im up to date on the problem, youre right, only chunk jobs appear to work
     
  18. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    232
    anyone else still getting subscene load failure in entities 17?

     

    Attached Files:

    Last edited: Jan 23, 2021
  19. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    988
    Same issue on my side.
    Re-cereating the subscene does not solve the issue, clearing cache either.
    Re-creating the subscene makes it work as long as it is open (effectively not being a subscene). But as soon as you close it, it fails and you can't reopen it...
     
  20. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    232
    think i found the problem, it is caused by the uitoolkit package
     
  21. elJoel

    elJoel

    Joined:
    Sep 7, 2016
    Posts:
    125
    So far so good, not getting any major errors or stuff thats not working anymore, I do get this warning:

    Code (CSharp):
    1. Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
    Don't really know where to start solving this.
     
  22. Elfinnik159

    Elfinnik159

    Joined:
    Feb 24, 2013
    Posts:
    145
    Has BlobAssets mechanics been updated in the new version? Can't contain reference types now? Or is it now done somehow differently? Can't find it in Changelog.
    After upgrading to 0.17, I get the following error:
     error ConstructBlobWithRefTypeViolation: You may not build a type RendererInfoBlobData with Construct as RendererInfoBlobData.material is a reference or pointer.  Only non-reference types are allowed in Blobs.

    for code:

    Code (CSharp):
    1.         ref var root = ref blobBuilder.ConstructRoot<RendererInfoBlobData>();
    2.  
    3. //...
    4. [System.Serializable]
    5. public struct RendererInfoBlobData
    6. {
    7.     //public Mesh mesh;
    8.     public Material material;
    9. }
    UPD:
    And now I cannot store BlobAssetReference in BlobAsset because it is Ptr. I used to be able to store nested data and simulate inheritance (via BlobArray <BlobAssetReference>), how should I do this now?
    Code (CSharp):
    1.     public BlobAssetReference<int> child;// from blob struct
    ...
    child.m_data.m_Ptr is a reference or pointer. Only non-reference types are allowed in Blobs.
     
    Last edited: Jan 23, 2021
  23. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    988
    I do have the UI tool kit too in my project.

    Adding
    [assembly: RegisterGenericComponentType(typeof(Unity.Entities.LinkedEntityGroup))]
    to a script in my project moved the issue along but did not solve all, now there are other issues whci do seem to point to the UI toolkit package :

    Code (CSharp):
    1. Received Prepare
    2. Registering precompiled user dll's ...
    3. Registered in 0.029488 seconds.
    4. ASSEMBLY OVERRIDE applied for Unity assembly UnityEngine.UIElementsModule.dll (override path Library/ScriptAssemblies/UnityEngine.UIElementsModule.dll)
    5. ASSEMBLY OVERRIDE applied for Unity assembly UnityEditor.UIElementsModule.dll (override path Library/ScriptAssemblies/UnityEditor.UIElementsModule.dll)
    6. Begin MonoManager ReloadAssembly
    7. The Handle has already been released.
    8. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    9. Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle:Release (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle)
    10. Unity.Entities.TypeManager:ShutdownSharedStatics () (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/Types/TypeManager.cs:506)
    11. Unity.Entities.TypeManager:Shutdown () (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/Types/TypeManager.cs:577)
    12. Unity.Entities.TypeManager/<>c:<Initialize>b__67_0 (object,System.EventArgs) (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/Types/TypeManager.cs:447)
    13. System.AppDomain:DoDomainUnload ()
    14.  
    15. [Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/Types/TypeManager.cs line 506]
    16.  
    17. Symbol file LoadedFromMemory is not a mono symbol file
    18. Error: Could not load signature of UnityEditor.UIElements.LiveReloadTrackerCreator:CreateVisualTreeAssetTrackerInstance due to: Could not resolve type with token 01000016 (from typeref, class/assembly UnityEngine.UIElements.ILiveReloadAssetTracker`1, UnityEngine.UIElementsModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null) assembly:UnityEngine.UIElementsModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:UnityEngine.UIElements.ILiveReloadAssetTracker`1 member:(null) signature:<none>
    19.  
    20. Error: Could not load signature of UnityEngine.UIElements.DynamicAtlasSettings:get_activeFilters due to: Could not resolve type with token 0100001a (from typeref, class/assembly UnityEngine.UIElements.DynamicAtlasFilters, UnityEngine.UIElementsModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null) assembly:UnityEngine.UIElementsModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:UnityEngine.UIElements.DynamicAtlasFilters member:(null) signature:<none>
    21.  
    22. The scripted importer 'UIElementsViewImporter' attempted to register file type '.uxml', which is handled by a native Unity importer. Registration rejected.
    23. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    24. UnityEditor.AssetImporters.ScriptedImporter:RegisterScriptedImporters ()
    25.  
    26. [C:\buildslave\unity\build\Modules/AssetDatabase/Editor/Public/ImporterRegistry.cpp line 245]
    27.  
    28. The scripted importer 'StyleSheetImporter' attempted to register file type '.uss', which is handled by a native Unity importer. Registration rejected.
    29. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    30. UnityEditor.AssetImporters.ScriptedImporter:RegisterScriptedImporters ()
    31.  
    32. [C:\buildslave\unity\build\Modules/AssetDatabase/Editor/Public/ImporterRegistry.cpp line 245]
    33.  
    34. The scripted importer 'ThemeStyleSheetImporter' attempted to register file type '.tss', which is handled by a native Unity importer. Registration rejected.
    35. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    36. UnityEditor.AssetImporters.ScriptedImporter:RegisterScriptedImporters ()
    37.  
    38. [C:\buildslave\unity\build\Modules/AssetDatabase/Editor/Public/ImporterRegistry.cpp line 245]
    39.  
    40. Unloading broken assembly Library/ScriptAssemblies/UnityEditor.UIElementsGameObjectsModule.dll, this assembly can cause crashes in the runtime
    41.  
    42. Unloading broken assembly Library/ScriptAssemblies/Unity.UIElements.Text.dll, this assembly can cause crashes in the runtime
    43.  
    44. Unloading broken assembly Library/ScriptAssemblies/UnityEngine.UIElementsGameObjectsModule.dll, this assembly can cause crashes in the runtime
    45.  
    46. Native extension for WindowsStandalone target not found
    47. Native extension for WebGL target not found
    48. Refreshing native plugins compatible for Editor in 0.97 ms, found 1 plugins.
    49. Preloading 0 native plugins for Editor in 0.00 ms.
    50. ASSEMBLY OVERRIDE applied for Unity assembly UnityEngine.UIElementsModule.dll (override path Library/ScriptAssemblies/UnityEngine.UIElementsModule.dll)
    51. ASSEMBLY OVERRIDE applied for Unity assembly UnityEditor.UIElementsModule.dll (override path Library/ScriptAssemblies/UnityEditor.UIElementsModule.dll)
    52. System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
    53.  at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
    54.  at System.Reflection.Assembly.GetTypes () [0x00000] in <9577ac7a62ef43179789031239ba8798>:0
    55.  at Unity.Entities.TypeManager.InitializeAllComponentTypes () [0x000da] in C:\Users\#USER#\Documents\GitHub\MGM-Demos\Library\PackageCache\com.unity.entities@0.17.0-preview.41\Unity.Entities\Types\TypeManager.cs:964
    56.  at Unity.Entities.TypeManager.Initialize () [0x00119] in C:\Users\#USER#\Documents\GitHub\MGM-Demos\Library\PackageCache\com.unity.entities@0.17.0-preview.41\Unity.Entities\Types\TypeManager.cs:476
    57.  at Unity.Entities.AttachToEntityClonerInjection.Initialize () [0x00001] in C:\Users\#USER#\Documents\GitHub\MGM-Demos\Library\PackageCache\com.unity.entities@0.17.0-preview.41\Unity.Entities.Hybrid\Injection\CompanionGameObject.cs:28
    58.  at Unity.Entities.AttachToEntityClonerInjection..cctor () [0x00001] in C:\Users\#USER#\Documents\GitHub\MGM-Demos\Library\PackageCache\com.unity.entities@0.17.0-preview.41\Unity.Entities.Hybrid\Injection\CompanionGameObject.cs:22
    59. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    60. UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    61. UnityEngine.Logger:Log (UnityEngine.LogType,object)
    62. UnityEngine.Debug:LogError (object)
    63. UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes (System.Type[])
    64.  
    65. Invoked RoslynAnalysisRunner static constructor.
    66. RoslynAnalysisRunner will not be running.
    67. RoslynAnalysisRunner has terminated.
    68. MissingFieldException: Field 'UnityEngine.UIElements.TextDelegates.ImportDefaultTextSettings' not found.
    69.  
    70.  
    71. MissingFieldException: Field 'UnityEngine.UIElements.UIDocument.IsEditorPlaying' not found.
    72.  
    73.  
    74. TypeLoadException: Could not resolve type with token 01000016 (from typeref, class/assembly UnityEngine.UIElements.ILiveReloadAssetTracker`1, UnityEngine.UIElementsModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null)
    75.  
    76.  
    77. UnityException: The MakeClientFunc has already been registered. Registration denied.
    78.  at UnityEngine.UIElements.DragAndDropUtility.RegisterMakeClientFunc (System.Func`1[TResult] makeClient) [0x00017] in <3cdf672c21b849dea215f9c9aff21f77>:0
    79.  at UnityEditor.UIElements.EditorDragAndDrop.RegisterEditorClient () [0x0000a] in <e020ad89c1af43769f98694c4076cf19>:0
    80.  
    81. ASSEMBLY OVERRIDE applied for Unity assembly UnityEngine.UIElementsModule.dll (override path Library/ScriptAssemblies/UnityEngine.UIElementsModule.dll)
    82. ASSEMBLY OVERRIDE applied for Unity assembly UnityEditor.UIElementsModule.dll (override path Library/ScriptAssemblies/UnityEditor.UIElementsModule.dll)
    83. Mono: successfully reloaded assembly
    84. ArgumentException: An item with the same key has already been added. Key: UnityEditor.UIElements.EditorAtlasMonitorInjector
    85. Parameter name: key
    86.  at System.Collections.Generic.SortedList`2[TKey,TValue].Add (TKey key, TValue value) [0x00041] in <aa976c2104104b7ca9e1785715722c9d>:0
    87.  at UnityEditor.AssetPostprocessingInternal.GetTextureProcessorsHashString () [0x000a2] in <1e441e8684a14fe4b8f8a926d91afc3a>:0
    88. UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
    89. UnityEngine.DebugLogHandler:LogException(Exception, Object)
    90. UnityEngine.Logger:LogException(Exception, Object)
    91. UnityEngine.Debug:LogException(Exception)
    92. UnityEditor.AssetPostprocessingInternal:GetTextureProcessorsHashString()
    93.  
    94. - Completed reload, in  2.396 seconds
    95. Platform modules already initialized, skipping
    96. Shader 'Universal Render Pipeline/Particles/Lit': fallback shader 'Universal Render Pipeline/Particles/SimpleLit' not found
    97. Shader 'Universal Render Pipeline/Particles/Lit': fallback shader 'Universal Render Pipeline/Particles/SimpleLit' not found
    98. Refreshing native plugins compatible for Editor in 1.22 ms, found 1 plugins.
    99. Preloading 0 native plugins for Editor in 0.00 ms.
    100. Unloading 4353 Unused Serialized files (Serialized files now loaded: 0)
    101. System memory in use before: 218.0 MB.
    102. System memory in use after: 214.8 MB.
    103.  
    104. Unloading 80 unused Assets to reduce memory usage. Loaded Objects now: 4898.
    105. Total: 8.250900 ms (FindLiveObjects: 0.526000 ms CreateObjectMapping: 0.206500 ms MarkObjects: 5.333400 ms  DeleteObjects: 2.183500 ms)
    The UI Document is not in the subscene itself, is not reference in any of the subcnece components and disableing it does not solve the issue.
     
  24. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
    Never was, it works previously only because Unity just not covered that area by validators, but blob builder always has these notes.
    upload_2021-1-23_22-27-0.png
     
  25. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    And to be clear, storing a managed reference in a blob asset can result in random crashes because the .NET GC might release the memory but you continue to have a reference on it. The documentation was always clear on that, but we had several projects accidentally put managed data into blob assets. Thats why we added the verifier.
     
    recursive likes this.
  26. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    We don't yet recommend using ISystemBase. It doesn't have all functionality yet.

    We are still working on getting full coverage of all functionality. The end goal with ISystemBase is of course that all main thread system code is burstable giving big speedups for system updates.
     
  27. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,105
    Thanks for all this :)

    One question about system/world planned performance.
    Do we have (do you have plans) to make ECS Worlds run on max speed like if we just call different system update methods in sequence from one place? How big overhead planned from running big amount of system in many worlds?

    As I know you recommend to use separate worlds for each session on battle server. In our current project (FPS like) we can easily handle 200 sessions on one machine on Google cloud and all this in one thread without burst. With burst and multi threaded it can be about 500 sessions per machine.

    Now we separate per session entities manually and this is pain. We want to make separate world for each session but this will result in too many systems running. 500 copies of each system running one after another in player loop.

    Actually they do the same job just each process chunks of separate world and have individual deltatime.
    So actual Question is: how big will be overhead of running 500 systems (same system in 500 worlds) on say 2 chunks for each (1K chunks) VS running 1 system (on one world) on 500*2 (1K) chunks? Do you have plans to make this difference to be zero or may be struct based ISystemBase already suppose to address this overhead?

    @Joachim_Ante can you explain what to expect please?
     
    Last edited: Jan 25, 2021
    UsmanMemon likes this.
  28. Elfinnik159

    Elfinnik159

    Joined:
    Feb 24, 2013
    Posts:
    145
    Oh... This was unexpected. Is there a recommended way to have BlobAssetReferences nested?
    I used the BlobArray <BlobAssetReferences<MyBaseStruct>> array and set structures of different types into it, bringing them to one (similar to physics colliders). This was needed to mimic inheritance in Burst Jobs .
    The physics code uses its own types, but maybe there is a recommended way for a regular BlobAsset?
    I tried to do this through BlobPtr, but I could not select the structure of type A and get a reference (BlobPtr) of type B to it.

    The changelog says about UnsafeUntypedBlobAssetReference, maybe this is what I need (This can be used for storing multiple types of blob assets in the same container)? But I also cannot figure out how to use it for this.
     
    Last edited: Jan 23, 2021
  29. Brian_Will

    Brian_Will

    Unity Technologies

    Joined:
    Apr 4, 2020
    Posts:
    13
    @tertle ISystemBase doesn't yet have lambda jobs.

    @ScottPeal I've been incrementally revising the manual pages and doing some restructuring that should make it more approachable. Most of the changes made won't show up until next release, and there's more to do, but it's worth another look now. Let me know if anything stands out as hard to follow.

    Another plan is to release some of our internal DOTS training material at some point, but that's probably at least a few releases away.
     
    NotaNaN, Kirsche, toomasio and 12 others like this.
  30. Luxxuor

    Luxxuor

    Joined:
    Jul 18, 2019
    Posts:
    89
    The difference for ISystemBase is impressive, for my custom tweening framework the execution time for the converted systems went from ~0.10 ms to 0.00ms if the systems debugger can be trusted (all safety checks disabled, using IJobChunk). Are you also considering bursting the update of ComponentSystemGroups as they now seem to be the biggest overhead?
     
    UsmanMemon likes this.
  31. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    232
    are generic primitive types not allowed either, or is this an error?
    it won't let me build a blob containing this:
     

    Attached Files:

    Elfinnik159 likes this.
  32. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
    Yes, currently added blob validators breaks generic blobs (in our case - generic utility for building blob asset references for reducing boilerplate) I already asked Unity about some workaround for this, something like
    IBlobData
    interface which we can use to mark struct as compatible for blobs and use this interface as generic constraint (and Unity can validate these structs in case if someone will put pointer or reference type inside)
     
  33. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    988
    Hello,

    With the release of entities 17, I'm moving some of my SystemBase to ISystemBase.

    Some of those system use nativehashmap for cache purposes.
    In a SystemBase it does not cause any issue but in ISystemBase I end up with that error message :

    Code (CSharp):
    1. ArgumentException: type WaynGroup.Mgm.Ability.AbilityUpdateRangeSystem cannot contain managed systems
    2. Unity.Entities.WorldUnmanagedImpl.CreateUnmanagedSystem (Unity.Entities.World self, System.Type t, System.Int64 typeHash) (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/WorldUnmanaged.cs:363)
    3. Unity.Entities.WorldUnmanagedImpl.CreateUnmanagedSystem (Unity.Entities.World self, System.Type t) (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/WorldUnmanaged.cs:415)
    4. Unity.Entities.WorldUnmanaged.CreateUnmanagedSystem (Unity.Entities.World self, System.Type unmanagedType) (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/WorldUnmanaged.cs:556)
    5. Unity.Entities.DefaultWorldInitialization.AddSystemToRootLevelSystemGroupsInternal (Unity.Entities.World world, System.Collections.Generic.IEnumerable`1[T] systemTypesOrig, System.Int32 managedTypesCountOrig) (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/DefaultWorldInitialization.cs:224)
    6. Unity.Entities.DefaultWorldInitialization.Initialize (System.String defaultWorldName, System.Boolean editorWorld) (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/DefaultWorldInitialization.cs:128)
    7. Unity.Entities.AutomaticWorldBootstrap.Initialize () (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities.Hybrid/Injection/AutomaticWorldBootstrap.cs:16)
    Does it mean that the ISystemBase must have the same consitraint has IComponentData, meaning be blittable ?

    EDIT : got my answer here https://forum.unity.com/threads/som...ng-isystembase-interface.994711/#post-6458365

    To update my cache I reference a SystemBase and subscribe to c# delegate for now I use
     state.EntityManager.World.GetOrCreateSystem
    . I confirmed it works fine and there are no issues wtih using managed system and managed type (dictionnary) in method in OnCreate.

    EDIT : that does not work, I was missing the [BurstCompile] on hte OnUpdate...
     
    Last edited: Jan 26, 2021
  34. LudiKha

    LudiKha

    Joined:
    Feb 15, 2014
    Posts:
    140
    I'm creating BlobAsset references using generic methods with type constrants as follows:

    Code (CSharp):
    1.  public static void CreateBlobAssetRef<TSettingsBlobType>(ref EntityManager entityManager, ProcedureGraphAsset graphAsset, in Entity e) where TSettingsBlobType : unmanaged
    2.     {
    3.       ...
    4.       ref var root = ref blobBuilder.ConstructRoot<TSettingsBlobType>();
    5.       ...
    6.  
    Unfortunately this isn't accepted, as the error claims TSettingsBlobType is a reference or pointer type (which it isn't). Is this an oversight in the validation code or intended behaviour?
     
    quabug likes this.
  35. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    988
    Did you check in the profiler ? I just tested my ISystemBase without burt and it report 0 in the system window which made me wonder why I would need to burst it but it reports .11 ms in profiler.

    I suspect ISystemBase don't report timming in the system window.
     
  36. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    In theory there really isn't a good reason why systems have so much overhead right now. These are things we are planning to optimise:
    * Generally bursting systems into having that code run with mono / il2cpp.
    * Scheduling jobs (We will definitely make that much faster, but there is inherent cost to scheduling a job so scheduling one job to process one chunk will never be effective)
    * General system overhead. Checking if it needs to run, Queries, GetComponentTypeHandle etc. There is definately fat there we can optimize

    It is hard to say how much faster it will get. Especially with bursting systems there is definitely a big speedup we can get. But I think expecting the perf difference between 500 system updates with 1 chunk each vs 1 system update with 500 chunks is unrealistic. Sorry but we just don't have any concrete data on this until we have done all those things and we can measure...

    One thing you can try to validate this is make a benchmark and test IJobChunk.Run in a fully bursted system and emulate your specific workload. We expect that Entities.ForEach will have as good or slightly better performance than IJobChunk.Run.
     
    dzamani, NotaNaN, Neonage and 2 others like this.
  37. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,105
    Thanks again :)

    Do I understand you right:
    • scheduling jobs (system updates, system group updates) will be optimized to be super optimal
    • jobs have overhead so scheduling jobs to process very few chunks never be good idea
    Speaking about worlds (not only systems), each world have 3 core system groups and we have overhead of calling update on these systems. If Server has 500 worlds than it has 1500 Core system groups and update of each is called through c++ to C# jump.

    Do you have plans to address this overhead sometime in future? May be unbound those core system groups from world and make it Universal for all worlds.

    Another thought is system that does not care about world at all, dont have any state and just update entities based solely on data in components. Such systems can work across worlds, just collect chunks from all worlds and process in one go.

    If this possible and have sense than such systems can greatly help exactly for ECS on battle server :)
     
    Enzi likes this.
  38. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    789
    I'm not sure about that, but I think that every world has its own entity-set, so it can exist in 2 and more worlds with entities with the same ID and version.
     
  39. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,105
    You are right, but does system care what Id entity has?
    It just change component data inside and totally ignore everything else :)

    I talk about systems with jobs like:
    Code (CSharp):
    1. Entities
    2.             .ForEach( (ref Translation translation, in Velocity velocity) =>
    3.             {
    4.                 translation.Value += velocity.Value;
    5.             })
    6.             .Schedule();
    This job can process any chunk without knowing what world it belongs to.
     
  40. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    789
    As long as you don't do anything with the entity itself, it can work, but there would still be some kind of filter to exclude certain worlds, I definitely don't want to let the data change in a serialization world.
     
    JesOb likes this.
  41. Neil-Corre

    Neil-Corre

    Joined:
    Nov 29, 2015
    Posts:
    38
    Hi there, credits to @Elfinnik159 for answering on a separate thread. Here are the posts in this thread that might help you out:

     
    LudiKha likes this.
  42. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    I think that "never" is a strong word, as using Run() requires the system to complete all its dependency immediately so in some cases you will still want the overhead of Schedule() to avoid that.
     
    JesOb likes this.
  43. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,113
    Hi @Brian_Will, @Joachim_Ante.
    1) Which Entities version will ship enable/disable component feature so I no longer need to put bool Enabled into component to do if check?
    2) Which Entities version will ship mega chunk feature so I dun longer need to create child entity to solve lot of components make total components size more than chunk size?
     
  44. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    954
    That's a good question as I was asking this myself for a multiplayer project with different worlds/channels/instances.
    The principle of having a set of systems work on multiple worlds because the worlds itself are just a copy of the main world and there's no need to have them run individually.

    It's odd in that sense that systems are strictly bound to worlds, 1 : N when it should be N : M. Personally I think it's a design flaw that could get problematic in the future as needs arise. I don't think this is problematic for single player games, mostly for multiplayer.
     
    UsmanMemon likes this.
  45. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    880
    Unity 2020.1.17
    After updating to Entites 0.17 my first opened scene in editor is loading twice when pressing Play. Does anyone have a similar issue?
     
  46. Brian_Will

    Brian_Will

    Unity Technologies

    Joined:
    Apr 4, 2020
    Posts:
    13
    @optimise I can't speak to larger chunk sizes, but I know the "Enabled Bits" feature requires making a number of invasive changes and answering a number of difficult design questions. You may see elements of it land in the next releases, but it likely won't be properly usable for a while still.
     
  47. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,113
    @Brian_Will Seems like it's still long time to go.

    Just check with you. Have u get the project from bug report?
     
  48. topher_r

    topher_r

    Unity Technologies

    Joined:
    Jun 14, 2019
    Posts:
    36
    I just had a look at this bug today. Sorry it took so long, it got a little lost in tracking!

    I've confirmed the bug and found the problem. It's quite an easy fix, but currently it will most likely land in whatever Entities release is after 0.18. I'll see if it's possible to get into the 0.18 release to get it to you sooner.
     
    optimise likes this.
  49. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,113
    @topher_r Awesome. Btw I see the similar issue when using hybrid component feature to make classic particle system converts into entity that drives companion game object but I believe internally it's still using similar
    UnityObject.Instantiate (I think is same as Object.Instantiate) API. Do u need that bug report too?
     
    Last edited: Feb 1, 2021
  50. topher_r

    topher_r

    Unity Technologies

    Joined:
    Jun 14, 2019
    Posts:
    36
    Well interestingly, the bug was caused by how we instantiate hybrid components. Can you clarify the problem you see with Hybrid Components in this case? Or maybe just a report with a repro is the easiest and I can take a look.