Search Unity

Question [SOLVED] Loading Entity Scene failed because the entity header file couldn't be resolved.

Discussion in 'Entity Component System' started by jdtec, Dec 7, 2020.

  1. jdtec

    jdtec

    Joined:
    Oct 25, 2017
    Posts:
    302
    I'm getting this when trying to run in the editor. Does anyone know how to resolve?

    Is there some cache to clear?
     
  2. jdtec

    jdtec

    Joined:
    Oct 25, 2017
    Posts:
    302
    Typically I've fixed it just after posting...

    I downgraded back to 2020.2 beta13 (from 14)
    And then DOTS->Clear entities caches and it's fixed
     
    charleshendry and BelkinAlex like this.
  3. charleshendry

    charleshendry

    Joined:
    Jan 7, 2018
    Posts:
    97
    Thanks! Had the same issue.
     
  4. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    232
    still here, after two months..
    a bug that completely breaks the project
    REEEEE
     
  5. AdamBebko

    AdamBebko

    Joined:
    Apr 8, 2016
    Posts:
    168
    I'm also getting this error
     
  6. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    232
    don't use outdated uitoolkit package, its inbuilt in unity now in latest alpha build
     
    AdamBebko likes this.
  7. andreiagmu

    andreiagmu

    Joined:
    Feb 20, 2014
    Posts:
    175
  8. bb8_1

    bb8_1

    Joined:
    Jan 20, 2019
    Posts:
    100
    In 1.0 (latest) also this bug happens from time to time - sometimes helps just to clear entity cash and sometimes you need even to exit Unity Editor and then start it again to disappear - also sometimes if i open subscene error is gone and when i close it error come back. Hopefully this will be fixed in next Unity dots versions
     
  9. YiboInsane

    YiboInsane

    Joined:
    Jul 22, 2019
    Posts:
    16
    Same here. Unity 2022.2.0b13 when building basic ECS system and hit build and run, you get empty screen, with
    -logFile log.txt

    I see the message
    Loading Entity Scene failed because the entity header file couldn't be resolved
     
    bb8_1 likes this.
  10. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    992
    The clear entity cache might help in these situations :
    upload_2022-11-5_1-57-10.png
     
  11. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    992
    It's been move to preferences > entities now. See post above.
     
    bb8_1 likes this.
  12. Aleksander_Wit

    Aleksander_Wit

    Joined:
    Dec 13, 2020
    Posts:
    19
    Thanks for the cache trick! Seems to help as a band-aid while things are still unstable and inconsistent!
     
  13. jennal

    jennal

    Joined:
    Oct 28, 2017
    Posts:
    24
    @jdtec It is not the bug of Unity, it is a bug of Entities package. And no matter you clear cache or not, the `sceneLoadDir` are always `StreamingAssets`. So the loadding process always fail if your subscene is not in that folder.

    upload_2022-11-8_10-26-5.png

    The full code is
    Code (CSharp):
    1.  
    2. //SceneHeaderUtility.cs: line 357
    3. public static void ScheduleHeaderLoadOnEntity(EntityManager EntityManager, Entity sceneEntity, Hash128 sceneGUID, RequestSceneLoaded requestSceneLoaded, Hash128 artifactHash, string sceneLoadDir)
    4. {
    5.     EntityManager.AddComponentData(sceneEntity, new ResolvedSceneHash { ArtifactHash = artifactHash });
    6.     EntityManager.AddComponentData(sceneEntity, CreateRequestSceneHeader(sceneGUID, requestSceneLoaded, artifactHash, sceneLoadDir));
    7. }
    8.  
     
    bb8_1 likes this.
  14. jennal

    jennal

    Joined:
    Oct 28, 2017
    Posts:
    24
    Sorry, I am wrong on this issue. It is cause by my own runtime error in BakeSystem which is not shown in console window. You can find it in
    Project/Logs
    folder.
     
    bb8_1 likes this.
  15. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    Looks like I got this issue by having a folder start with a numeral instead of a letter.

    Edit: Nope, that didn't work, still having this issue.
     
    Last edited: Nov 27, 2022
  16. Deleted User

    Deleted User

    Guest

    I don't know how to fix, but I've noticed that when there isn't a folder called "GlobalEntitiesDependencies" with a ScriptableObject inside. It's likely that the Player (not editor) will fail to run. I cleared the cache and then the folder appeared. I'll test a build now to confirm my thoughts.
     
    tjumma likes this.
  17. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    So I updated to 1.0.0-Pre.15 (which I had to do manually) and all my issues are gone. Must have been a bug that needed to be fixed. Thanks Unity DOTS team!
     
    apkdev and FlightFight like this.
  18. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    Okay, so it came back. Turns out I was opening stuff in Visual Studio 2019. Make sure it is 2022 or you are gonna have a bad time.
     
    apkdev and FlightFight like this.
  19. tjumma

    tjumma

    Joined:
    Sep 30, 2019
    Posts:
    12
    Anyone facing the Loading Entity Scene failed because the entity header file couldn't be resolved issue:

    I've figured out that this issue is rarely related to the problem with the SubScene itself, but instead is cause by the Exception thrown by Burst compilation during the SubScene import. To try and identify the source of the real problem you can:
    1. Disable the SubScene in the Hierarchy and run the PlayMode - sometimes it shows the bugs and exceptions that are not show with the SubScene being turned on (such as
    GetSingleton() requires that exactly one entity exists that matches this query, but there are {0}
    )
    unity_1.png

    2. After getting the Loading Entity Scene failed because the entity header file couldn't be resolved error, go to /Logs folder of your project and open the "AssetImportWorker[0-N].log file.
    unity_2.png

    Type in the "Exception" in the search - you will probably be able to find something like this:

    unity_3.png

    In my case, the compilation exception was caused by incorrectly managing native collections. In yours - it might be smth else. Anyway, you can comment out the problematic code and try building again to check if it indeed is the source of the problem. Hope it helps!:rolleyes:
     
  20. peterhayman

    peterhayman

    Joined:
    Jan 17, 2023
    Posts:
    3
    Same here. Thanks for the heads up, I would have never figured that out
     
  21. chantey

    chantey

    Joined:
    Mar 5, 2017
    Posts:
    49
    @tjumma would you mind detailing exactly how the native collection was incorrectly managed? In my case I'm getting this error in builds when including the following field in my `IComponentData`, using Unity DOTS 1.0:

    Code (CSharp):
    1.     public struct MyLookup : IComponentData
    2.     {
    3.         public NativeHashMap<int, MyStruct> Value;
    4.     }
    5.  
    EDIT:
    I think my issue is that i was trying to add the component in the baker, which looks like it isnt supported
     
    Last edited: Feb 16, 2023
  22. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    982
    Really helpful. Thanks!
     
  23. lgarczyn

    lgarczyn

    Joined:
    Nov 23, 2014
    Posts:
    68
    Oh thank you so much for this, it was the actual issue
     
  24. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Same issue, but I have no exceptions ;-/
     
  25. Kleptine

    Kleptine

    Joined:
    Dec 23, 2013
    Posts:
    282
    This does seem to pop up when your SubScene throws errors during import. However, the error it's throwing seems to be within Entities and ECB playback. Not fixed by any above solution. Clearing the cache does nothing.

    This is a fairly simple project, and pretty annoying:

    Code (CSharp):
    1. 1.0.16/Unity.Entities/EntityCommandBuffer.cs:3645
    2.   at Unity.Entities.BakedEntityData.ApplyBakeInstructions (Unity.Entities.Baking.BakeDependencies& dependencies, Unity.Entities.Baking.IncrementalBakingContext+IncrementalBakeInstructions instructions, Unity.Entities.BlobAssetStore blobAssetStore, Unity.Entities.BakingSettings bakingSettings, Unity.Entities.Conversion.IncrementalHierarchy& hierarchy, Unity.Entities.Baking.GameObjectComponents& components) [0x01144] in ./Library/PackageCache/com.unity.entities@1.0.16/Unity.Entities.Hybrid/Baking/BakedEntityData.cs:872
    3.   at Unity.Entities.BakingSystem.Bake (Unity.Entities.IncrementalBakingChangeTracker changeTracker, UnityEngine.GameObject[] cleanRootGameObjects) [0x00103] in ./Library/PackageCache/com.unity.entities@1.0.16/Unity.Entities.Hybrid/Baking/BakingSystem.cs:155
    4.   at Unity.Entities.BakingUtility.BakeScene (Unity.Entities.World conversionWorld, UnityEngine.SceneManagement.Scene scene, Unity.Entities.BakingSettings settings, System.Boolean incremental, Unity.Entities.IncrementalBakingChangeTracker changeTracker) [0x0004e] in ./Library/PackageCache/com.unity.entities@1.0.16/Unity.Entities.Hybrid/Baking/BakingUtility.cs:83
    5.   at Unity.Scenes.Editor.EditorEntityScenes.BakeAndWriteEntityScene (UnityEngine.SceneManagement.Scene scene, Unity.Entities.BakingSettings settings, System.Collections.Generic.List`1[T] sectionRefObjs, Unity.Scenes.Editor.WriteEntitySceneSettings writeEntitySettings) [0x0003d] in ./Library/PackageCache/com.unity.entities@1.0.16/Unity.Scenes.Editor/EditorEntityScenes.cs:77
    6.   at Unity.Scenes.Editor.SubSceneImporter.ImportBaking (UnityEditor.AssetImporters.AssetImportContext ctx, UnityEngine.SceneManagement.Scene scene, Unity.Scenes.SceneWithBuildConfigurationGUIDs sceneWithBuildConfiguration, Unity.Entities.Build.IEntitiesPlayerSettings settingsAsset, UnityEngine.GameObject prefab) [0x0007d] in ./Library/PackageCache/com.unity.entities@1.0.16/Unity.Scenes.Editor/SubSceneImporter.cs:157
    7.   at Unity.Scenes.Editor.SubSceneImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) [0x000d8] in ./Library/PackageCache/com.unity.entities@1.0.16/Unity.Scenes.Editor/SubSceneImporter.cs:253
    8. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:206)