I really wanna know how often you all are getting the error Loading Entity Scene failed because the entity header file couldn't be resolved.
- Never
- Sometimes
- A lot
I’m literally plagued by it and I don’t know why.
I really wanna know how often you all are getting the error Loading Entity Scene failed because the entity header file couldn't be resolved.
I’m literally plagued by it and I don’t know why.
Lately, I’ve only ever gotten it when I broke the rules of baking systems.
It has surprised me how often others seem to encounter this, because whenever it happens to me, it always ends up being my fault. I’m not saying that’s true for everyone else, just that I’ve not been able to reproduce the experience.
Do you remember how one of those errors looked like? I’m not ruling out that I’m doing something wrong but I don’t have any baker errors nor does anything else not work as expected.
I’m having those in my rather simple TPC asset project and more advanced ones.
I most often encounter the error the first time I try to rebake the subscene after fixing the baking issue that caused some kind of exception. Or sometimes what happens is I will get a baking exception while a subscene is closed, I will open the subscene and iterate on code to fix things, and then when I close it, that’s when I sometimes get it.
Pretty much every UAS asset is a legal conflict of interest for me these days, so unfortunately I can’t test that out to see what’s wrong.
Whole unity 6000.0.16+ broken for a webgl build. I am scared that they no longer support web for dots (again…). I mean at least for the last 4 versions it cant load subscenes in the build.
Ah, I thought something more subtle. An exception would be quite obvious.
This is what I got last time I digged into it.
[Worker0] Exception thrown during SubScene import: System.InvalidCastException: Specified cast is not valid.
at (wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr)
at System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer[TDelegate] (System.IntPtr ptr) [0x00010] in <467dcef8ceb84c1e92dc7c69d21858a8>:0
at Unity.Burst.FunctionPointer`1[T].get_Invoke () [0x00008] in ./Library/PackageCache/com.unity.burst/Runtime/FunctionPointer.cs:68
at Unity.Entities.WorldUnmanagedImpl..ctor (Unity.Entities.World worldManaged, System.UInt64 sequenceNumber, Unity.Entities.WorldFlags flags, Unity.Collections.AllocatorHelper`1[T] worldAllocatorHelper, System.String worldName) [0x000a2] in ./Library/PackageCache/com.unity.entities/Unity.Entities/WorldUnmanaged.cs:254
s_UnmanagedUpdateFn = BurstCompiler.CompileFunctionPointer<UnmanagedUpdateSignature>(UnmanagedUpdate).Invoke; in WorldUnmanaged.cs i did not find any usage so i threw a try/catch around it and just logged the error. no exception is thrown so world init can continue. then i get the following state: using Clear Entity cache logs an error here: s_UnmanagedUpdateFn = BurstCompiler.CompileFunctionPointer<UnmanagedUpdateSignature>(UnmanagedUpdate).Invoke; but nothing more. Subscene reimport throws a new one:
[Worker0] Specified cast is not valid.
UnityEditor.Experimental.AssetDatabaseExperimental:LookupArtifact (UnityEditor.Experimental.ArtifactKey)
Unity.Scenes.AssetDatabaseCompatibility:GetArtifactHash (UnityEditor.GUID,System.Type,Unity.Scenes.ImportMode) (at ./Library/PackageCache/com.unity.entities/Unity.Scenes/AssetDatabaseCompatibility.cs:47)
Unity.Scenes.AssetDatabaseCompatibility:GetArtifactHash (string,System.Type,Unity.Scenes.ImportMode) (at ./Library/PackageCache/com.unity.entities/Unity.Scenes/AssetDatabaseCompatibility.cs:55)
Unity.Scenes.EntityScenesPaths:GetSubSceneArtifactHash (Unity.Entities.Hash128,Unity.Entities.Hash128,bool,Unity.Scenes.ImportMode) (at ./Library/PackageCache/com.unity.entities/Unity.Scenes/EntityScenesPaths.cs:75)
Unity.Scenes.Editor.SubSceneInspector:IsSubsceneImported (Unity.Scenes.SubScene,Unity.Scenes.ImportMode) (at ./Library/PackageCache/com.unity.entities/Unity.Scenes.Editor/SubSceneInspector.cs:479)
Unity.Scenes.Editor.SubSceneInspector:DrawClosedSubScenes (Unity.Scenes.Editor.SubSceneInspectorUtility/LoadableScene[],Unity.Scenes.SubScene[]) (at ./Library/PackageCache/com.unity.entities/Unity.Scenes.Editor/SubSceneInspector.cs:204)
Unity.Scenes.Editor.SubSceneInspector:OnInspectorGUI () (at ./Library/PackageCache/com.unity.entities/Unity.Scenes.Editor/SubSceneInspector.cs:386)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /home/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:219)
Bumping this to get more votes and to bait an answer from entities team. ![]()
[Worker0] Exception thrown during SubScene import: System.InvalidCastException: Specified cast is not valid.
at (wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr)
at System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer[TDelegate] (System.IntPtr ptr) [0x00010] in <321eb2db7c6d43ea8fc39b54eaca3452>:0
at Unity.Burst.FunctionPointer`1[T].get_Invoke () [0x00008] in .\Library\PackageCache\com.unity.burst\Runtime\FunctionPointer.cs:68
at Unity.Entities.WorldUnmanagedImpl..ctor (Unity.Entities.World worldManaged, System.UInt64 sequenceNumber, Unity.Entities.WorldFlags flags, Unity.Collections.AllocatorHelper`1[T] worldAllocatorHelper, System.String worldName) [0x000a2] in .\Library\PackageCache\com.unity.entities\Unity.Entities\WorldUnmanaged.cs:254
at Unity.Entities.WorldUnmanaged.Create (Unity.Entities.World world, Unity.Entities.WorldFlags flags, Unity.Collections.AllocatorManager+AllocatorHandle backingAllocatorHandle) [0x00069] in .\Library\PackageCache\com.unity.entities\Unity.Entities\WorldUnmanaged.cs:1017
at Unity.Entities.World.Init (Unity.Entities.WorldFlags flags, Unity.Collections.AllocatorManager+AllocatorHandle backingAllocatorHandle) [0x00012] in .\Library\PackageCache\com.unity.entities\Unity.Entities\World.cs:238
at Unity.Entities.World..ctor (System.String name, Unity.Entities.WorldFlags flags) [0x0003e] in .\Library\PackageCache\com.unity.entities\Unity.Entities\World.cs:213
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) [0x00001] in .\Library\PackageCache\com.unity.entities\Unity.Scenes.Editor\EditorEntityScenes.cs:61
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) [0x0007c] in .\Library\PackageCache\com.unity.entities\Unity.Scenes.Editor\SubSceneImporter.cs:123
at Unity.Scenes.Editor.SubSceneImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) [0x000d8] in .\Library\PackageCache\com.unity.entities\Unity.Scenes.Editor\SubSceneImporter.cs:202
Stuff like this, hundres of times per day, almost after every playmode session
still getting this in about 5% of every time I load a Scene with an Entity Subscene, but I fix it by enabling scene editing, dragging out all my objects, deleting the old subscene in inspector and in file explorer, creating a new subscene, dragging objects into there, opening a different scene, closing Unity, reopening Unity, then reopening the sub scene for it to work fine
I don’t think you have to go to such a large extent to fix it unless there’s something else going wrong.
For me, very rarely Clean Entity Cache helps and when not, I restart Unity and hit it again. Alternatively close Unity, clean SceneDependencyCache folder and start again.
Let me know if it works.
I also do those steps, forgot to include them in my original comment, I originally just compounded a bunch of stuff I thought might work, and some combination of all the steps eventually led to success, but I’ll try Clean Entity Cache and cleaning SceneDependencyCache only next time the issue pops up
Anyone who gets consistent InvalidCastExceptions and SubScenes breaking, can you try:
Go into project settings, editor, change your worker count to 1, restart editor
In the editor, it never happens to me.
but in runtime, I can’t load a single subscene by myself and it is always this error.
I finally managed to create a very small reliable repro which I reported to QA as well as directly to a developer and they’ve been able to reproduce it.
Public tracker for issue: Unity Issue Tracker - SubScene baking breaks with the "SelectManagedFn failed to cast Unity.Burst.FunctionPointer" warning when reloading domain with multiple workers
Is that link still working for you? i get “The page you were looking for doesn’t exist.”
When I get it Clear Entity Cache seems to fixes it.
Yeah I don’t know why the link broke, that was the one with redirecting from the email. Enzi posted the updated one though.
Side update from a 10 days ago:
update: mono bug man is actively debugging as we speak and has reproed on his actual machine in his actual house. thanks again for the repro project!
i.e. being worked on.