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

Bug [1.0] Loading Entity Scene failed because the entity header file couldn't be resolved

Discussion in 'Entity Component System' started by OlympusGames, Nov 2, 2022.

  1. OlympusGames

    OlympusGames

    Joined:
    Feb 22, 2017
    Posts:
    7
    I'm trying to build an ECS 1.0 game with no success. Everything works when I play it in the editor, but when I build it, it doesn't load my sub-scene and gives me this error.
    I've tried building it for Windows as well as iOS, but both have the same issue.
    The full log file is in the attachments.
     

    Attached Files:

  2. bogdancoder

    bogdancoder

    Unity Technologies

    Joined:
    Feb 6, 2017
    Posts:
    29
    This error often indicates that the subscene has failed to be built. Probably an exception was thrown somewhere in the SubSceneImporter. You can check the Editor log to see if there is any suspicious entry.
     
  3. OlympusGames

    OlympusGames

    Joined:
    Feb 22, 2017
    Posts:
    7
    I didn't found anything in Editor log, but I downgraded from version 2022.2.0b13 to 2022.2.0b10 and it started working for windows build, I then returned to 2022.2.ob13 and it still worked, so I don't really know what changed. As for iOS, I now have another error when running the build:

    Code (CSharp):
    1. ArgumentException: Cannot find TypeIndex for type hash 7881543491081840453
     
  4. Kirkules_

    Kirkules_

    Joined:
    Aug 5, 2014
    Posts:
    65
    Set your code stripping level to Minimal (/maybe low). The type is being stripped.
     
  5. Kirkules_

    Kirkules_

    Joined:
    Aug 5, 2014
    Posts:
    65
    I'm having the same problem on Android
    Error Unity Loading Entity Scene failed because the entity header file couldn't be resolved.
    Works in editor.
     
  6. jennal

    jennal

    Joined:
    Oct 28, 2017
    Posts:
    24
    It is a bug of Entities package. And there are no other errors, the `sceneLoadDir` are always `StreamingAssets`. So the loadding process always fail if your subscene is not in that folder.

    View attachment 1147247

    The full code is
    Code (CSharp):
    1. //SceneHeaderUtility.cs: line 357
    2. public static void ScheduleHeaderLoadOnEntity(EntityManager EntityManager, Entity sceneEntity, Hash128 sceneGUID, RequestSceneLoaded requestSceneLoaded, Hash128 artifactHash, string sceneLoadDir)
    3. {
    4.     EntityManager.AddComponentData(sceneEntity, new ResolvedSceneHash { ArtifactHash = artifactHash });
    5.     EntityManager.AddComponentData(sceneEntity, CreateRequestSceneHeader(sceneGUID, requestSceneLoaded, artifactHash, sceneLoadDir));
    6. }
     
  7. 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.
     
  8. Cachete

    Cachete

    Joined:
    Jul 4, 2017
    Posts:
    3
    I have the same problem.
    @jennal could you provide more details on what you've found exactly?
     
  9. jennal

    jennal

    Joined:
    Oct 28, 2017
    Posts:
    24
    Just check the logs in
    Project/Logs
    folder, if there are errors in Worker Thread, it may not show in console, but it is in log files.

    This is the main issue of many other issues may cause this problem. When you solve the error in the log, you can try clear cache button. If still not working, try remove
    Library
    ,
    obj
    ,
    Logs
    folders, and restart your Unity, it will finally work...for a while.
     
  10. toomasio

    toomasio

    Joined:
    Nov 19, 2013
    Posts:
    195
    Having this problem regularly. Project runs fine but after making some changes to code for about 1/2 hour I get this error until I delete the Library folder....then it works again. No idea what is going on.
     
  11. mizak

    mizak

    Joined:
    Jun 5, 2014
    Posts:
    14
    This bug is killing me. constantly happening with no log file to help me debug and the error changes each time.
     
    tjumma likes this.
  12. 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:
     
  13. skaxander94

    skaxander94

    Joined:
    Nov 27, 2019
    Posts:
    1
    Same problem. Trying to load a scene using SceneSystem. It works in Editor, but doesn't work on Android build. I tried to use SceneAssets folder and Scriptable builder. Nothing helps.

    I am trying to load a scene using hash128 guid.

    I found in logs that when I use SubScene component it loads a scene correctly. But when loading it adds ".entities" after the guid. Log example:

    2023.10.09 23:04:05.662 19484 19595 Debug Unity Streamed scene with 1961ms latency from jar:file:///data/app/~~RWHWpovQiJYpnt7szAfLlA==/com.UnityTechnologies.com.unity.template.urpblank-IVvstJ5yno8IeLamiA6DKA==/base.apk!/assets/EntityScenes/1d89734e7f78f7745b69aae862e49a1f.0.entities


    But when I'm trying to load my scenes with SceneSystem.LoadSceneAsync with guid, the logs are:


    2023.10.09 23:04:18.601 19484 19661 Error Unity Could not open file jar:file:///data/app/~~RWHWpovQiJYpnt7szAfLlA==/com.UnityTechnologies.com.unity.template.urpblank-IVvstJ5yno8IeLamiA6DKA==/base.apk!/assets/EntityScenes/caf342305d65b0e469187d7a3e599aea.entityheader for read


    Why there is .entities in the first time and .entityheader in the second? What am I doing wrong?

    UPD.
    Found the decision.
    I put all the subscenes in to my main scene and turned off autoload. And now I can download scenes with guid.
    Only subscenes monobehaviour get into a build.
     
    Last edited: Oct 10, 2023