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 Loading Entity Scene failed because the entity header file couldn't be resolved.

Discussion in 'Entity Component System' started by MicCode, Dec 9, 2022.

  1. MicCode

    MicCode

    Joined:
    Nov 19, 2018
    Posts:
    58
    Using Unity 2022.2.0b16 and entities 1.0.0-exp12

    Basically every time I change some c# code, unity recompiles, it happens
    Restarting editor and clearing entities cache in preference doesn't help.

    You can see which subscene is affected by toggling the subscene
    The only fix I found is open the subscene, move all object out of subscene, then move it back it and save it.
    Doesn't work all the time though, something even if you delete every gameobject in the subscene so that you leave it empty, it still shows that error when toggling the subscene.

    The thing is after the above "fix" is done, I check the git commit, nothing has change, not a single line in the subscene file, or the meta file. I guess some file has gone corrupted somewhere in the Library folder.
    Deleting the library folder will of course fix it as well.

    Opening the asset import log like the error suggested show this:
    Code (csharp):
    1.  
    2. Exception thrown during SubScene import: System.NullReferenceException: Object reference not set to an instance of an object
    3.   at Unity.Entities.TypeManager.CallManagedEquals (System.Void* left, System.Void* right, Unity.Entities.TypeIndex typeIndex, System.Boolean& wasequal, System.Boolean& didwrite) [0x00004] in C:\RenderTest\Library\PackageCache\com.unity.entities@1.0.0-exp.12\Unity.Entities\Types\TypeManager.cs:1777
    4.   at Unity.Entities.TypeManager.EqualsWithBurst (System.Void* left, System.Void* right, Unity.Entities.TypeIndex typeIndex) [0x00019] in C:\RenderTest\Library\PackageCache\com.unity.entities@1.0.0-exp.12\Unity.Entities\Types\TypeManager.cs:1764
    5.   at Unity.Entities.EntityComponentStore.FindSharedComponentIndex (Unity.Entities.TypeIndex typeIndex, System.Int32 hashCode, System.Void* newData, System.Void* defaultValue, Unity.Collections.LowLevel.Unsafe.UnsafeList`1[Unity.Entities.EntityComponentStore+SharedComponentInfo]*& infos, Unity.Entities.ComponentTypeList*& components) [0x0001b] in C:\RenderTest\Library\PackageCache\com.unity.entities@1.0.0-exp.12\Unity.Entities\EntityComponentStore.cs:1485
    Search on the forum:
    https://forum.unity.com/threads/sol...ile-couldnt-be-resolved.1018339/#post-8563187
    https://forum.unity.com/threads/1-0...ile-couldnt-be-resolved.1356305/#post-8566238
     
  2. OUTTAHERE

    OUTTAHERE

    Joined:
    Sep 23, 2013
    Posts:
    656
    This bug seems to no longer occur to me with Entities-1.0.0-pre.15 for me.

    I had it all the time with exp.12, workaround there was clearing Entity Cache in Preferences and then restarting unity. Sometimes.
     
  3. MicCode

    MicCode

    Joined:
    Nov 19, 2018
    Posts:
    58
    Just noticed new entities version released today, will try that.
     
  4. MicCode

    MicCode

    Joined:
    Nov 19, 2018
    Posts:
    58
    Still happen in Entities-1.0.0-pre.15 with 2022.2.0f1
    Will try to find a way to reproduce
     
    tjumma likes this.
  5. 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}
    )


    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.


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



    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:
     
    PolarTron likes this.