No SceneSection Warnings

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.

I’m getting the same warnings and am interested in the solution to this.

Same, can’t, for the love of it, find the Entity that causes this.

I wrote a system to debug this and it indicates that StaticOptimizeBakingSystemState is the culprit.

Here is the code for those who are interested:

    [WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)]
    [UpdateInGroup(typeof(BakingSystemGroup), OrderLast = true)]
    public partial class SubSceneDebuggingSystem : SystemBase
    {
        private EntityQuery _noSectionQuery;

        protected override void OnCreate()
        {
            base.OnCreate();
          
            _noSectionQuery = GetEntityQuery(
                new EntityQueryDesc
                {
                    None = new[] {ComponentType.ReadWrite<SceneSection>()},
                    Options = EntityQueryOptions.IncludePrefab | EntityQueryOptions.IncludeDisabledEntities
                }
            );
          
            RequireForUpdate(_noSectionQuery);
        }

        protected override void OnUpdate()
        {
            if (_noSectionQuery.IsEmpty)
            {
                return;
            }
            var entities = _noSectionQuery.ToEntityArray(Allocator.TempJob);
            foreach (var entity in entities)
            {
                Debug.LogWarning($"{EntityManager.GetName(entity)} has no SceneSection!");
            }
            entities.Dispose();
        }
    }
6 Likes

This happens to me with Unity Physics package installed. The warnings go away if I remove the package.

2 Likes

It maybe due to Netcode for Entities package.

We are using the Unity Physics package, but are not using the Unity Netcode package. It might happen with either one.

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.

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 :slight_smile:

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.

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. ¯_(ツ)_/¯

1 Like

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

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:

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>
1 Like

Just open asset import logs and you’ll see actual error which is preventing SubScene from load

Do you mean a …\Logs\AssetImportWorker0.log?
AssetImportWorker0.log message triggered by SubSceneComponent Reimport

Received Import Request.
  Time since last request: 137.442620 seconds.
  path: Assets/SceneDependencyCache/45fbc2b8fa1059836e4732e8f27a3e04.sceneWithBuildSettings
  artifactKey: Guid(45fbc2b8fa1059836e4732e8f27a3e04) Importer(2089858483,52bed625d08a7023a15481c3fbd73797)
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'
Loaded scene 'Assets/---Scenes/_editor/cartesian elements tests/New Sub Scene 1.unity'
    Deserialize:            0.731 ms
    Integration:            0.622 ms
    Integration of assets:  0.003 ms
    Thread Wait Time:       0.015 ms
    Total Operation Time:   1.371 ms
1 entities in the scene 'New Sub Scene 1' had no SceneSection and as a result were not serialized at all.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:LogWarning (object)
Unity.Debug:LogWarning (object) (at ./Packages/com.unity.entities@1.0.0-pre.47/Unity.Entities/Stubs/Unity/Debug.cs:15)
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)
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)
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)
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)
Unity.Scenes.Editor.SubSceneImporter:OnImportAsset (UnityEditor.AssetImporters.AssetImportContext) (at ./Packages/com.unity.entities@1.0.0-pre.47/Unity.Scenes.Editor/SubSceneImporter.cs:253)
UnityEditor.AssetImporters.ScriptedImporter:GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext)

(Filename: ./Packages/com.unity.entities@1.0.0-pre.47/Unity.Entities/Stubs/Unity/Debug.cs Line: 15)

-> (artifact id: '3c1076d3d359c72b3577219e00998de5') in 0.088407 seconds
Number of updated asset objects reloaded before import = 0
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

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:
8866608--1210191--upload_2023-3-10_15-17-35.png

I am facing the same problem, and the project is empty, just testing the physics system and it already generates the error

I have not seen any real problems coming from this warning, so I am just ignoring it for now.