Building standalone DOTS/ECS players - multiple errors

So many bugs and errors encountered trying to build a standalone player of a DOTS+Netcode project… I’ve been working on just getting a working build for the last two days. This last batch of errors I just don’t know how to approach and can’t find any solutions. For this I’ve taken the BuildConfiguration files from the Unity sampleproject, I’ve checked my settings and packages according to the entities documentation and the netcode documentation. On top of that I’ve tried dozens of variations of different settings combinations.
packages

“com.unity.cinemachine”: “2.6.3”,
“com.unity.dots.editor”: “0.12.0-preview.6”,
“com.unity.ide.vscode”: “1.2.3”,
“com.unity.inputsystem”: “1.0.2”,
“com.unity.netcode”: “0.6.0-preview.7”,
“com.unity.performance.profile-analyzer”: “1.0.3”,
“com.unity.physics”: “0.6.0-preview.3”,
“com.unity.platforms.android”: “0.10.0-preview.10”,
“com.unity.platforms.ios”: “0.10.0-preview.10”,
“com.unity.platforms.linux”: “0.10.0-preview.10”,
“com.unity.platforms.macos”: “0.10.0-preview.10”,
“com.unity.platforms.windows”: “0.10.0-preview.10”,
“com.unity.render-pipelines.universal”: “10.3.2”,
“com.unity.rendering.hybrid”: “0.11.0-preview.42”,
“com.unity.searcher”: “4.3.1”,
“com.unity.textmeshpro”: “3.0.4”,
“com.unity.timeline”: “1.4.6”,
“com.unity.toolchain.linux-x86_64”: “0.1.18-preview”,
“com.unity.ugui”: “1.0.0”,
“com.unity.ui.builder”: “1.0.0-preview.12”,
“com.unity.vfx-toolbox”: “GitHub - Unity-Technologies/VFXToolbox: Additional tools for Visual Effect Artists”,
“com.unity.visualeffectgraph”: “10.3.2”,

The build runs “successfull” but when I run the player, I don’t get my scene and the log has the following errors.
The errors from log

ReflectionTypeLoadException: Exception of type ‘System.Reflection.ReflectionTypeLoadException’ was thrown.
at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <676178d6abc542efbc88c5a7f99e8f88>:0
at Unity.Entities.TypeManager.InitializeAllComponentTypes () [0x000cd] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/Types/TypeManager.cs:964
at Unity.Entities.TypeManager.Initialize () [0x000fc] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/Types/TypeManager.cs:476
at Unity.Entities.AttachToEntityClonerInjection.Initialize () [0x00001] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities.Hybrid/Injection/CompanionGameObject.cs:28
at Unity.Entities.AttachToEntityClonerInjection…cctor () [0x00001] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities.Hybrid/Injection/CompanionGameObject.cs:22
Rethrow as TypeInitializationException: The type initializer for ‘Unity.Entities.AttachToEntityClonerInjection’ threw an exception.

DefaultWorldInitialization failed loading assembly: /home/tommi/Documents/Repos/FaradayDOTS/Builds/Linux-Server/Faraday_Data/Managed/Assembly-CSharp.dll
UnityEngine.StackTraceUtility:ExtractStackTrace () (at /home/bokken/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs:37)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[ ])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:LogWarning (object)
Unity.Debug:LogWarning (object) (at /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/Stubs/Unity/Debug.cs:15)
Unity.Entities.TypeManager:GetTypesDerivedFrom (System.Type) (at /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/Types/TypeManagerSystems.cs:300)
Unity.Entities.DefaultWorldInitialization:CreateBootStrap () (at /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/DefaultWorldInitialization.cs:335)
Unity.Entities.DefaultWorldInitialization:Initialize (string,bool) (at /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/DefaultWorldInitialization.cs:113)
Unity.Entities.AutomaticWorldBootstrap:Initialize () (at /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities.Hybrid/Injection/AutomaticWorldBootstrap.cs:16)

(Filename: /home/bokken/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs Line: 37)

ArgumentException: Unknown Type:Unity.Entities.LinkedEntityGroup All ComponentType must be known at compile time. For generic components, each concrete type must be registered with [RegisterGenericComponentType].
at Unity.Entities.TypeManager.ManagedException (System.Type type) [0x00023] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/Types/TypeManager.cs:632
at Unity.Entities.TypeManager.ManagedException[T] () [0x00001] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/Types/TypeManager.cs:613
at Unity.Entities.TypeManager.GetTypeIndex[T] () [0x00019] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/Types/TypeManager.cs:641
at Unity.Entities.EntityComponentStore.Create (Unity.Entities.EntityComponentStore* entities, System.UInt64 startChunkSequenceNumber, System.Int32 newCapacity) [0x000c0] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/EntityComponentStore.cs:432
at Unity.Entities.EntityDataAccess.Initialize (Unity.Entities.EntityDataAccess* self, Unity.Entities.World world) [0x0004b] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/EntityDataAccess.cs:191
at Unity.Entities.EntityManager.Initialize (Unity.Entities.World world) [0x00066] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/EntityManager.cs:213
at Unity.Entities.WorldUnmanaged.Create (Unity.Entities.World world, Unity.Entities.WorldFlags flags) [0x0004c] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/WorldUnmanaged.cs:504
at Unity.Entities.World…ctor (System.String name, Unity.Entities.WorldFlags flags) [0x0001e] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/World.cs:133
at Unity.Entities.DefaultWorldInitialization.Initialize (System.String defaultWorldName, System.Boolean editorWorld) [0x00047] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/DefaultWorldInitialization.cs:124
at Unity.Entities.AutomaticWorldBootstrap.Initialize () [0x00001] in /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities.Hybrid/Injection/AutomaticWorldBootstrap.cs:16

(Filename: /home/tommi/Documents/Repos/FaradayDOTS/Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/Types/TypeManager.cs Line: 632)

Unknown Type:Unity.Entities.LinkedEntityGroup All ComponentType must be known at compile time. For generic components, each concrete type must be registered with [RegisterGenericComponentType].

Looks to be pointing to the Entities package itself. So I’m wondering if others who are on the latest(0.17) have this issue and if someone has a solution?

On a sidenote, the instructions and tools for building are all over the place, some settings should be set in the old “build settings”, some in the “player settings” scripting defines and some in the BuildConfiguration. And then you have multiple duplicate possibilities. For example its unclear to me if “ENABLE_UNITY_RENDERER_V2” and “UNITY_CLIENT” will be activated on all builds if set in the player settings. We can also set those on the BuildConfiguration assets, which one has precedence? Would “UNITY_SERVER” work if set in the BuildConfiguration asset and not in the “build settings”?

Right, after a long and depressing rebuilding process I got a working copy for a while, but then it suddenly broke again. Fortunately I had a backup of the working copy so rebuilding on that was not as painful. Narrowing down all the changes one by one, it seems the cuplrit is a section in the projectSettings.asset
managedStrippingLevel:
Standalone: 1
This is a setting I have and would never change manually, because I have no idea what it does. For some reason unity seems to be fond of randomly changing this value and messing with my sanity. Thanks.

The value had to be 0 for me. 1,2 and 3 would create different runtime errors.
Hopefully this will help someone else.

4 Likes

@twaananen Are you using latest Unity 2021.2.0f1?

Are you using Generic Classes anywhere?

Unity 2021.1 was and is the version I’m on, moved there before the compatibility notice. It’s of course possible this is what created this problem.

Nothing custom and I did try registering types like NativeArray and DynamicBuffer in the one place where I use them currently, without luck.

Anyway with the above setting, the build now works and hopefully I can continue until the next chapter of DOTS lands.

1 Like