Search Unity

Building with netcode causes exception in build complaingin about TypeManager, works in editor

Discussion in 'NetCode for ECS' started by Mikael-H, Apr 25, 2020.

  1. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    When running a build I get the following exception, I would be very grateful if someone could hint at what it means:

    Code (logfile):
    1. AssertionException: Assertion failure. Value was False
    2. Expected: True
    3. The TypeManager must be initialized before the TypeManager can be used.
    4.   at UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) [0x0003c] in C:\buildslave\unity\build\Runtime\Export\Assertions\Assert\AssertBase.cs:29
    5.   at UnityEngine.Assertions.Assert.IsTrue (System.Boolean condition, System.String message) [0x00009] in C:\buildslave\unity\build\Runtime\Export\Assertions\Assert\AssertBool.cs:20
    6.   at Unity.Assertions.Assert.IsTrue (System.Boolean condition, System.String message) [0x00008] in D:\Development\unity games\dots-netcode-car-game\Library\PackageCache\com.unity.entities@0.9.1-preview.15\Unity.Entities\Stubs\Unity.Assertions\Assert.cs:24
    7.   at Unity.Entities.TypeManager.GetSystemAttributes (System.Type systemType, System.Type attributeType) [0x00001] in D:\Development\unity games\dots-netcode-car-game\Library\PackageCache\com.unity.entities@0.9.1-preview.15\Unity.Entities\Types\SystemTypeManager.cs:123
    8.   at Unity.NetCode.ClientServerBootstrap.GetSystemAttribute[T] (System.Type systemType) [0x00001] in D:\Development\unity games\dots-netcode-car-game\Library\PackageCache\com.unity.netcode@0.1.0-preview.6\Runtime\ClientServerWorld\ClientServerBootstrap.cs:232
    9.   at Unity.NetCode.ClientServerBootstrap.GenerateSystemLists (System.Collections.Generic.IReadOnlyList`1[T] systems) [0x0009d] in D:\Development\unity games\dots-netcode-car-game\Library\PackageCache\com.unity.netcode@0.1.0-preview.6\Runtime\ClientServerWorld\ClientServerBootstrap.cs:251
    10.   at Unity.NetCode.ClientServerBootstrap.Initialize (System.String defaultWorldName) [0x00009] in D:\Development\unity games\dots-netcode-car-game\Library\PackageCache\com.unity.netcode@0.1.0-preview.6\Runtime\ClientServerWorld\ClientServerBootstrap.cs:31
    11.   at NetCodeBootstrap.Initialize (System.String defaultWorldName) [0x00051] in D:\Development\unity games\dots-netcode-car-game\Assets\Samples\NetCodeBootstrap.cs:14
    12.   at Unity.Entities.DefaultWorldInitialization.Initialize (System.String defaultWorldName, System.Boolean editorWorld) [0x00016] in D:\Development\unity games\dots-netcode-car-game\Library\PackageCache\com.unity.entities@0.9.1-preview.15\Unity.Entities.Hybrid\Injection\DefaultWorldInitialization.cs:97
    13.   at Unity.Entities.AutomaticWorldBootstrap.Initialize () [0x00001] in D:\Development\unity games\dots-netcode-car-game\Library\PackageCache\com.unity.entities@0.9.1-preview.15\Unity.Entities.Hybrid\Injection\AutomaticWorldBootstrap.cs:15
    14. (Filename: C:/buildslave/unity/build/Runtime/Export/Assertions/Assert/AssertBase.cs Line: 29)
    15.  
    16. NullReferenceException: Object reference not set to an instance of an object
    17.   at Unity.NetCode.ConvertToClientServerEntity.Awake () [0x00001] in D:\Development\unity games\dots-netcode-car-game\Library\PackageCache\com.unity.netcode@0.1.0-preview.6\Runtime\Authoring\ConvertToClientServerEntity.cs:24
    18. (Filename: D:/Development/unity games/dots-netcode-car-game/Library/PackageCache/com.unity.netcode@0.1.0-preview.6/Runtime/Authoring/ConvertToClientServerEntity.cs Line: 24)
    19.  
    20. NullReferenceException: Object reference not set to an instance of an object
    21.   at Unity.NetCode.ConvertToClientServerEntity.Awake () [0x00001] in D:\Development\unity games\dots-netcode-car-game\Library\PackageCache\com.unity.netcode@0.1.0-preview.6\Runtime\Authoring\ConvertToClientServerEntity.cs:24
    22. (Filename: D:/Development/unity games/dots-netcode-car-game/Library/PackageCache/com.unity.netcode@0.1.0-preview.6/Runtime/Authoring/ConvertToClientServerEntity.cs Line: 24)
     
  2. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    Through some binary search in my repo history I realized it was when I upgraded to latest entity package that I started getting exceptions in builds. (Not while building, but when running built binaries)

    I reproduced this by downloading a clean version of the netcode github repo and tried upgrading the entities package of it.

    Maybe something was upgraded in the entity versions that I haven't taken care of properly :)

    @timjohansson is this a known issue? If not, would you like me to post a bug? If so, on github or in the editor bug reporting tool?

    Used package versions:
    "com.unity.entities": "0.9.1-preview.15",
    "com.unity.netcode": "0.1.0-preview.6",
    "com.unity.transport": "0.3.0-preview.6",
     
  3. TheUltimateRichu

    TheUltimateRichu

    Joined:
    Dec 25, 2018
    Posts:
    11
    Hi

    I'm getting the same problem. I tried with initializing the typeManager before any other script executes, but it doesn't work.
     
    Mikael-H likes this.
  4. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    Downgrading to entitites 0.6 worked for me. I haven't tried any versions between 0.6 and 0.9 so there might be others that also work.
     
    TheUltimateRichu likes this.
  5. TheUltimateRichu

    TheUltimateRichu

    Joined:
    Dec 25, 2018
    Posts:
    11
    Thank You

    I will try thad. I hope I can use the latest version of the Unity Physics package despite not using the latest Entities version.
     
  6. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    I'm on physics 0.2.5, that works with entities 0.6. Looking at the latest physics (0.3.2) looks like it needs entities 0.9, so that will probably not work for you. You might get away with 0.3.1 though!
     
  7. TheUltimateRichu

    TheUltimateRichu

    Joined:
    Dec 25, 2018
    Posts:
    11
    I was on Physics 0.3.1 before I upgraded. This works properly. I'm trying to just downgrade entities. With a bit of luck it could work although the version doesn't fit the requirements.
     
  8. TheUltimateRichu

    TheUltimateRichu

    Joined:
    Dec 25, 2018
    Posts:
    11
    Physics 0.3.2 seems to work with Entities 0.8.0
     
    Mikael-H and florianhanke like this.
  9. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    I've hit this as well, sadly – thanks for the help above! :)
    I wonder about the NetCode release and update frequency. Lots of releases at the end of 2019, then the last release in Feb 2020, and now nothing, even though adapting to the latest entities must have become easier and easier…? (And save us tons of trouble)
     
  10. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    I see in the changelog that there was a null refernce issue fixed in Entities 0.9.1 related to systembase which I use in my code. Any of you guys tried that version?
     
  11. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    With Entities Version 0.9.1-preview.15 I am still getting

    Code (CSharp):
    1. OSXPlayer(...) AssertionException: Assertion failure. Value was False
    2. Expected: True
    3. The TypeManager must be initialized before the TypeManager can be used.
    resulting in
    World.DefaultGameObjectInjectionWorld
    being null.

    Edit: Initializing the TypeManager in my ClientServerBootstrap causes the error to go away.
    Code (CSharp):
    1. public class WorldBootstrap : ClientServerBootstrap
    2. {
    3.     public override bool Initialize(string defaultWorldName)
    4.     {
    5.         Debug.Log("Executing multi player bootstrap");
    6.  
    7.         TypeManager.Initialize(); // <-- Added
    8.         return base.Initialize(defaultWorldName);
    9.     }
    10. }
    However, I get a probably unrelated error:
    Could not open file MyGameName.app/Contents/Resources/Data/StreamingAssets/livelink-bootstrap for read


    Edit 2:
    {
    "dependencies": {
    "com.unity.audio.dspgraph": "0.1.0-preview.11",
    "com.unity.burst": "1.3.0-preview.12",
    "com.unity.collections": "0.7.1-preview.3",
    "com.unity.dots.editor": "0.5.1-preview",
    "com.unity.entities": "0.9.1-preview.15",
    "com.unity.ide.rider": "2.0.2",
    "com.unity.jobs": "0.2.8-preview.3",
    "com.unity.netcode": "0.1.0-preview.6",
    "com.unity.nuget.newtonsoft-json": "1.1.2",
    "com.unity.physics": "0.3.1-preview",
    "com.unity.platforms": "0.2.2-preview.10",
    "com.unity.platforms.desktop": "0.2.2-preview.10",
    "com.unity.platforms.macos": "0.2.2-preview.10",
    "com.unity.properties": "1.2.0-preview",
    "com.unity.render-pipelines.core": "9.0.0-preview.13",
    "com.unity.render-pipelines.universal": "9.0.0-preview.14",
    "com.unity.rendering.hybrid": "0.4.0-preview.8",
    "com.unity.serialization": "1.2.0-preview",
    "com.unity.ugui": "1.0.0",
    "com.unity.visualeffectgraph": "9.0.0-preview.13",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
    }
    }
     
    Last edited: May 10, 2020
    Mikael-H likes this.
  12. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    Ok, thanks for sharing the info! That seems like it would be worth trying out and see if I get the same error as you.
     
    florianhanke likes this.
  13. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    What's weird though is that on Unity 2020.1.0b7, the player entity is created after connecting, and on Unity 2020.2.0a10 it is not. (In case hat applies to you, @Mikael-H)
     
    Mikael-H likes this.
  14. pavelmo4alov

    pavelmo4alov

    Joined:
    Mar 13, 2013
    Posts:
    14
    florianhanke likes this.
  15. AdamBebko

    AdamBebko

    Joined:
    Apr 8, 2016
    Posts:
    168
    florianhanke likes this.