Search Unity

Bug No SceneSection Warnings

Discussion in 'Entity Component System' started by redwren, Jan 11, 2023.

  1. redwren

    redwren

    Joined:
    Aug 2, 2019
    Posts:
    69
    I frequently get warnings about:

    [Worker0] 1 entities in the scene 'Main Entities' had no SceneSection and as a result were not serialized at all.

    I can reproduce it pretty easily in a fresh project (Unity 2022.2.1, Entities 1.0.0-pre.15) with a subscene with one empty game object. The Entity Baking Preview for that one empty game object also shows a scene section component.
     
  2. Dan-Foster

    Dan-Foster

    Joined:
    Aug 7, 2019
    Posts:
    53
    I'm getting the same warnings and am interested in the solution to this.
     
  3. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    Same, can't, for the love of it, find the Entity that causes this.
     
  4. desertGhost_

    desertGhost_

    Joined:
    Apr 12, 2018
    Posts:
    260
    I wrote a system to debug this and it indicates that StaticOptimizeBakingSystemState is the culprit.

    Here is the code for those who are interested:

    Code (CSharp):
    1.     [WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)]
    2.     [UpdateInGroup(typeof(BakingSystemGroup), OrderLast = true)]
    3.     public partial class SubSceneDebuggingSystem : SystemBase
    4.     {
    5.         private EntityQuery _noSectionQuery;
    6.  
    7.         protected override void OnCreate()
    8.         {
    9.             base.OnCreate();
    10.          
    11.             _noSectionQuery = GetEntityQuery(
    12.                 new EntityQueryDesc
    13.                 {
    14.                     None = new[] {ComponentType.ReadWrite<SceneSection>()},
    15.                     Options = EntityQueryOptions.IncludePrefab | EntityQueryOptions.IncludeDisabledEntities
    16.                 }
    17.             );
    18.          
    19.             RequireForUpdate(_noSectionQuery);
    20.         }
    21.  
    22.         protected override void OnUpdate()
    23.         {
    24.             if (_noSectionQuery.IsEmpty)
    25.             {
    26.                 return;
    27.             }
    28.             var entities = _noSectionQuery.ToEntityArray(Allocator.TempJob);
    29.             foreach (var entity in entities)
    30.             {
    31.                 Debug.LogWarning($"{EntityManager.GetName(entity)} has no SceneSection!");
    32.             }
    33.             entities.Dispose();
    34.         }
    35.     }
     
  5. Tsoj88

    Tsoj88

    Joined:
    Nov 27, 2020
    Posts:
    2
    This happens to me with Unity Physics package installed. The warnings go away if I remove the package.
     
    FlightFight and redwren like this.
  6. LittleBigRex

    LittleBigRex

    Joined:
    Aug 11, 2021
    Posts:
    11
    It maybe due to Netcode for Entities package.
     
  7. redwren

    redwren

    Joined:
    Aug 2, 2019
    Posts:
    69
    We are using the Unity Physics package, but are not using the Unity Netcode package. It might happen with either one.
     
  8. andrew-lukasik

    andrew-lukasik

    Joined:
    Jan 31, 2013
    Posts:
    249
    Did anyone submitted a bug report for this?
    I remember working around this issue earlier but since baking workflow was introduced this breaks dots projects entirely.
     
  9. Quit

    Quit

    Joined:
    Mar 5, 2013
    Posts:
    63
    Getting this as well. The whole ECS is very fragile at the moment. Not surprising - it's written up from scratch with little time for 1000s of people to destroy it. Still finding loads of editor/basic implementation bugs. But it's getting better :)
     
  10. tangell

    tangell

    Joined:
    Aug 11, 2017
    Posts:
    18
    On a related note, I was getting this error AND losing components on entities in subscenes when exiting playmode. They would be there before loading playmode, and be gone upon exiting playmode.

    The solution for me was to remove an old version of the Substance 3D (Allegorithmic) plugin that was still remnant in my project. Removed that and my components stopped disappearing.
     
  11. pbhogan

    pbhogan

    Joined:
    Aug 17, 2012
    Posts:
    382
    I've been getting this for quite a while now (Entities, Physics and Netcode). Doesn't seem to be breaking anything, so I've just been ignoring it. ¯\_(ツ)_/¯
     
    desertGhost_ likes this.
  12. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    857
    i reported this as IN-33127, even though you can ignore it im unsure what is really happening behind the scenes. found that subscene baking is rather brittle currently, sometimes things work, sometimes the cache needs to be cleared
     
  13. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    I think they forget to clean up something during baking, it appears to be related to some sort of static physics component; so actually runtime behaviour might be different from what you expext.

    However, the baking bug that REALLY gets on my nerves, and that really stops work, is:
    Code (CSharp):
    1. Loading Entity Scene failed because the entity header file couldn't be resolved. This might be caused by a failed import of a subscene. Please try to reimport the subscene Ship Spawning from its inspector, look at any errors/exceptions in the console or look at the asset import worker log in <your  log directory>
    2.  
     
    redwren likes this.
  14. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,684
    Just open asset import logs and you'll see actual error which is preventing SubScene from load
     
  15. andrew-lukasik

    andrew-lukasik

    Joined:
    Jan 31, 2013
    Posts:
    249
    Do you mean a ...\Logs\AssetImportWorker0.log?
    Code (CSharp):
    1. Received Import Request.
    2.   Time since last request: 137.442620 seconds.
    3.   path: Assets/SceneDependencyCache/45fbc2b8fa1059836e4732e8f27a3e04.sceneWithBuildSettings
    4.   artifactKey: Guid(45fbc2b8fa1059836e4732e8f27a3e04) Importer(2089858483,52bed625d08a7023a15481c3fbd73797)
    5. Start importing Assets/SceneDependencyCache/45fbc2b8fa1059836e4732e8f27a3e04.sceneWithBuildSettings using Guid(45fbc2b8fa1059836e4732e8f27a3e04) Importer(2089858483,52bed625d08a7023a15481c3fbd73797) Opening scene 'Assets/---Scenes/_editor/cartesian elements tests/New Sub Scene 1.unity additively'
    6. Loaded scene 'Assets/---Scenes/_editor/cartesian elements tests/New Sub Scene 1.unity'
    7.     Deserialize:            0.731 ms
    8.     Integration:            0.622 ms
    9.     Integration of assets:  0.003 ms
    10.     Thread Wait Time:       0.015 ms
    11.     Total Operation Time:   1.371 ms
    12. 1 entities in the scene 'New Sub Scene 1' had no SceneSection and as a result were not serialized at all.
    13. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    14. UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    15. UnityEngine.Logger:Log (UnityEngine.LogType,object)
    16. UnityEngine.Debug:LogWarning (object)
    17. Unity.Debug:LogWarning (object) (at ./Packages/com.unity.entities@1.0.0-pre.47/Unity.Entities/Stubs/Unity/Debug.cs:15)
    18. Unity.Scenes.Editor.EditorEntityScenes:WriteEntitySceneInternal (Unity.Entities.EntityManager,Unity.Entities.Hash128,string,UnityEditor.AssetImporters.AssetImportContext,System.Collections.Generic.List`1<Unity.Scenes.ReferencedUnityObjects>,Unity.Scenes.Editor.WriteEntitySceneSettings) (at ./Packages/com.unity.entities@1.0.0-pre.47/Unity.Scenes.Editor/EditorEntityScenes.cs:541)
    19. Unity.Scenes.Editor.EditorEntityScenes:WriteEntitySceneInternalBaking (Unity.Entities.EntityManager,Unity.Entities.Hash128,string,UnityEditor.AssetImporters.AssetImportContext,System.Collections.Generic.List`1<Unity.Scenes.ReferencedUnityObjects>,Unity.Scenes.Editor.WriteEntitySceneSettings) (at ./Packages/com.unity.entities@1.0.0-pre.47/Unity.Scenes.Editor/EditorEntityScenes.cs:156)
    20. Unity.Scenes.Editor.EditorEntityScenes:BakeAndWriteEntityScene (UnityEngine.SceneManagement.Scene,Unity.Entities.BakingSettings,System.Collections.Generic.List`1<Unity.Scenes.ReferencedUnityObjects>,Unity.Scenes.Editor.WriteEntitySceneSettings) (at ./Packages/com.unity.entities@1.0.0-pre.47/Unity.Scenes.Editor/EditorEntityScenes.cs:91)
    21. Unity.Scenes.Editor.SubSceneImporter:ImportBaking (UnityEditor.AssetImporters.AssetImportContext,UnityEngine.SceneManagement.Scene,Unity.Scenes.SceneWithBuildConfigurationGUIDs,Unity.Entities.Build.IEntitiesPlayerSettings,Unity.Build.BuildConfiguration,UnityEngine.GameObject) (at ./Packages/com.unity.entities@1.0.0-pre.47/Unity.Scenes.Editor/SubSceneImporter.cs:158)
    22. Unity.Scenes.Editor.SubSceneImporter:OnImportAsset (UnityEditor.AssetImporters.AssetImportContext) (at ./Packages/com.unity.entities@1.0.0-pre.47/Unity.Scenes.Editor/SubSceneImporter.cs:253)
    23. UnityEditor.AssetImporters.ScriptedImporter:GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext)
    24.  
    25. (Filename: ./Packages/com.unity.entities@1.0.0-pre.47/Unity.Entities/Stubs/Unity/Debug.cs Line: 15)
    26.  
    27. -> (artifact id: '3c1076d3d359c72b3577219e00998de5') in 0.088407 seconds
    28. Number of updated asset objects reloaded before import = 0
    29. Number of asset objects unloaded after import = 1
    Idk I see no useful info here


    EDIT: No exceptions nor errors in my case either :V
     
    Last edited: Mar 10, 2023
  16. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,684
    Yes and it has all the info, but beware that tthis file can be updated a bit later than actual exception. And search by Exception and you'll see actual error of why SubScene can't be processed in case you don't see proper error in console.
    For example:
    upload_2023-3-10_15-17-35.png
     
  17. FernandoMK

    FernandoMK

    Joined:
    Feb 21, 2017
    Posts:
    178
    I am facing the same problem, and the project is empty, just testing the physics system and it already generates the error
     
  18. Arnold_2013

    Arnold_2013

    Joined:
    Nov 24, 2013
    Posts:
    285
    I have not seen any real problems coming from this warning, so I am just ignoring it for now.