Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug NETCODE 1 1.7

Discussion in 'Netcode for GameObjects' started by firebird721, Nov 16, 2023.

  1. firebird721

    firebird721

    Joined:
    Jun 8, 2022
    Posts:
    101
    I UPGRADED MY NETCODE TO 1.7

    I GOT NEW ERROR I DIDNT HAVE BEOFRE

    Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP: (0,0): error - System.NullReferenceException: Object reference not set to an instance of an object.|| at Unity.Netcode.Editor.CodeGen.CodeGenHelpers.MakeGeneric(MethodReference self, TypeReference[] arguments)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[] assemblyDefines)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.<>c__DisplayClass7_0.<Process>b__1(TypeDefinition b)|| at System.Collections.Generic.List`1.ForEach(Action`1 action)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly) at Unity.Netcode.Editor.CodeGen.CodeGenHelpers.MakeGeneric(MethodReference self, TypeReference[] arguments)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[] assemblyDefines)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.<>c__DisplayClass7_0.<Process>b__1(TypeDefinition b)|| at System.Collections.Generic.List`1.ForEach(Action`1 action)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly)
     
  2. NoelStephens_Unity

    NoelStephens_Unity

    Unity Technologies

    Joined:
    Feb 12, 2022
    Posts:
    244
    Hi Firebird721,

    Can you provide the entire stack trace for me?
     
    firebird721 likes this.
  3. firebird721

    firebird721

    Joined:
    Jun 8, 2022
    Posts:
    101
    I asked chatgpt - it said that this is confirmed problem - if he is right then i want to downgrade to 1.6 but i didnt succed in that

    this is evertyhing i have:
    Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP: (0,0): error - System.NullReferenceException: Object reference not set to an instance of an object.|| at Unity.Netcode.Editor.CodeGen.CodeGenHelpers.MakeGeneric(MethodReference self, TypeReference[] arguments)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[] assemblyDefines)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.<>c__DisplayClass7_0.<Process>b__1(TypeDefinition b)|| at System.Collections.Generic.List`1.ForEach(Action`1 action)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly) at Unity.Netcode.Editor.CodeGen.CodeGenHelpers.MakeGeneric(MethodReference self, TypeReference[] arguments)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[] assemblyDefines)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.<>c__DisplayClass7_0.<Process>b__1(TypeDefinition b)|| at System.Collections.Generic.List`1.ForEach(Action`1 action)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly)

    all worked well then i upgraded and got this - i use lts 2022

    chat gpt:
    The error you're encountering in Unity after upgrading to Netcode 1.7 and using LTS 2022 seems to be related to issues during the upgrading process. Here are some steps and considerations that might help you resolve the issue:

    1. Backup Your Project: Before upgrading to Netcode from MLAPI, it's essential to backup your entire project. This is crucial because the new version modifies files and locations drastically different from previous MLAPI versions. You can create a copy of your entire project folder and use source control software like Git.

    2. Use the Upgrade Tool: Manually upgrading from the .dll version installed by MLAPI to the new package version breaks all MLAPI component references in your scenes and prefabs. An upgrade tool is available to help with this process. To start upgrading, add the upgrade tool to your project using the Add package from git URL option in the Package Manager window with this URL: https://github.com/Unity-Technologi...unity.multiplayer.mlapi-patcher#release-0.1.0.

    3. Install the Netcode Package: After installing the upgrade tool, you should follow the installation guide to install Netcode. Note that installing the Netcode package will result in error messages in the console because your project will have MLAPI and Netcode at the same time, which is expected. The Burst package, which is also installed, requires an Editor restart.
     
    Last edited: Nov 16, 2023
  4. NoelStephens_Unity

    NoelStephens_Unity

    Unity Technologies

    Joined:
    Feb 12, 2022
    Posts:
    244
    Hold off on the Chat gpt suggestion as that is not a correct fix for this issue.
    Just a few more questions so I can see if we can get a bit more information.
    What platform are you targeting?
    What does your stack trace settings look like?
    upload_2023-11-16_14-15-17.png
     
  5. firebird721

    firebird721

    Joined:
    Jun 8, 2022
    Posts:
    101
    Here it is

    Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP: (0,0): error - System.NullReferenceException: Object reference not set to an instance of an object.|| at Unity.Netcode.Editor.CodeGen.CodeGenHelpers.MakeGeneric(MethodReference self, TypeReference[] arguments)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[] assemblyDefines)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.<>c__DisplayClass7_0.<Process>b__1(TypeDefinition b)|| at System.Collections.Generic.List`1.ForEach(Action`1 action)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly) at Unity.Netcode.Editor.CodeGen.CodeGenHelpers.MakeGeneric(MethodReference self, TypeReference[] arguments)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[] assemblyDefines)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.<>c__DisplayClass7_0.<Process>b__1(TypeDefinition b)|| at System.Collections.Generic.List`1.ForEach(Action`1 action)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly)
    Assembly 'Library/ScriptAssemblies/Assembly-CSharp-Editor.dll' will not be loaded due to errors:
    Unable to resolve reference 'Assembly-CSharp'. Is the assembly missing or incompatible with the current platform?
    Reference validation can be disabled in the Plugin Inspector.
     

    Attached Files:

    Last edited: Nov 16, 2023
  6. NoelStephens_Unity

    NoelStephens_Unity

    Unity Technologies

    Joined:
    Feb 12, 2022
    Posts:
    244
    Just out of curiosity, do you have any classes that derived from NetworkBehaviour that follow this type of pattern:
    • 2ndGenChildClass
    • Has RPCs defined
    • 1stGenChildClass
    • Has no RPCs defined
    • (parent) NetworkBehaviour
    Example:
    Code (CSharp):
    1. public class SecondGenChild : FirstGenChild
    2. {
    3.    [ServerRpc]
    4.    public void SomeServerRpc()
    5.    {
    6.  
    7.    }
    8. }
    9.  
    10. public class FirstGenChild : NetworkBehaviour
    11. {
    12.    // No RPCs declared
    13. }
    There is a known issue in v1.7.0 where if you have multigeneration children where one generation of the children has no RPCs but the later generation derived children do it can cause that kind of exception. We have a fix for this (v1.71) that should be public by (hopefully) sometime next week.

    If this is the case, then you have two options until the hot-patch update is available:

    Option #1: Add A Temporary RPC To Middle Generation Child:

    Code (CSharp):
    1. public class SecondGenChild : FirstGenChild
    2. {
    3.    [ServerRpc]
    4.    public void SomeServerRpc()
    5.    {
    6.  
    7.    }
    8. }
    9.  
    10. public class FirstGenChild : NetworkBehaviour
    11. {
    12.    // Temporary work around
    13.    [ServerRpc]
    14.    private void TempServerRpc()
    15.    {
    16.  
    17.    }
    18. }
    The type of RPC you add doesn't matter if it is ClientRpc or ServerRpc...just that it has "an RPC" in it.

    Option #2: Modify Your Project's Manifest File:

    Replace your manifest file com.unity.netcode.gameobjects entry with this:
    Code (CSharp):
    1. "com.unity.netcode.gameobjects": "https://github.com/Unity-Technologies/com.unity.netcode.gameobjects.git?path=com.unity.netcode.gameobjects#develop"
    This will use the develop branch that already has the fix in it and then you can just update to v1.7.1 when it is released.

    Using one of the two above options should resolve your issue.
     
    firebird721 likes this.
  7. firebird721

    firebird721

    Joined:
    Jun 8, 2022
    Posts:
    101
    THX ALLOT - I used the manifest fix to downgrade to 1.6 and netcode return to life but..
    dont know what splines is not recognised anymore

    Assets\HAGGAI_STUFF\My_Scripts\LoadingScene\WavesManager.cs(7,13): error CS0234: The type or namespace name 'Splines' does not exist in the namespace 'Unity' (are you missing an assembly reference?)
    All compiler errors have to be fixed before you can enter playmode!
    0x00007ffe0f8f1b3d (Unity) StackWalker::GetCurrentCallstack
    0x00007ffe0f8f6b03 (Unity) StackWalker::ShowCallstack
    0x00007ffe108a401d (Unity) GetStacktrace
    0x00007ffe10facf56 (Unity) DebugStringToFile
    0x00007ffe0ea6d3a7 (Unity) DebugLogHandler_CUSTOM_Internal_Log_Injected
    0x00000189d512fdba (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log_Injected (UnityEngine.LogType,UnityEngine.LogOption,string,intptr)
    0x00000189d512fc3b (Mono JIT Code) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
    0x00000189d512facb (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    0x00000189d512ef4e (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object)
    0x00000189d512ecaa (Mono JIT Code) UnityEngine.Debug:LogError (object)
    0x00000189d512eb0b (Mono JIT Code) UnityEditor.SceneView:ShowNotification (string)
    0x00000189d512dfb3 (Mono JIT Code) UnityEditor.SceneView:ShowCompileErrorNotification ()
    0x0000018919a57145 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
    0x00007ffead7c5f2e (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
    0x00007ffead707a54 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3066)
    0x00007ffead707b40 (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3113)
    0x00007ffe0f7f02ed (Unity) CallStaticMonoMethod
    0x00007ffe0f7f007c (Unity) CallStaticMonoMethod
    0x00007ffe1043eca6 (Unity) PlayerLoopController::SetIsPlaying
    0x00007ffe1044264a (Unity) Application::TickTimer
    0x00007ffe108aab6a (Unity) MainMessageLoop
    0x00007ffe108b0426 (Unity) UnityMain
    0x00007ff6f0ae29fa (Unity) __scrt_common_main_seh
    0x00007fff37cb257d (KERNEL32) BaseThreadInitThunk
    0x00007fff38c4aa88 (ntdll) RtlUserThreadStart


    i tried going to 4.2 in splines thru the manifest but both lateset vresion didnt work

    here is my json

    {
    "dependencies": {
    "com.unity.2d.sprite": "1.0.0",
    "com.unity.2d.tilemap": "1.0.0",
    "com.unity.addressables": "1.21.19",
    "com.unity.ai.navigation": "1.1.5",
    "com.unity.burst": "1.8.10",
    "com.unity.cinemachine": "2.9.7",
    "com.unity.collab-proxy": "2.2.0",
    "com.unity.collections": "2.1.4",
    "com.unity.connect.share": "4.2.3",
    "com.unity.feature.2d": "2.0.0",
    "com.unity.ide.rider": "3.0.26",
    "com.unity.ide.visualstudio": "2.0.22",
    "com.unity.inputsystem": "1.7.0",
    "com.unity.netcode.gameobjects": "1.7.0",
    "com.unity.postprocessing": "3.3.0",
    "com.unity.progrids": "3.0.3-preview.6",
    "com.unity.recorder": "4.0.2",
    "com.unity.render-pipelines.universal": "15.0.7",
    "com.unity.services.authentication": "3.1.0",
    "com.unity.services.lobby": "1.1.1",
    "com.unity.services.matchmaker": "1.1.2",
    "com.unity.services.relay": "1.0.5",
    "com.unity.splines": "2.4.0",
    "com.unity.test-framework": "1.3.9",
    "com.unity.textmeshpro": "3.0.6",
    "com.unity.timeline": "1.8.5",
    "com.unity.transport": "2.1.0",
    "com.unity.ugui": "1.0.0",
    "com.unity.vectorgraphics": "2.0.0-preview.21",
    "com.unity.visualscripting": "1.9.1",
    "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"
    },
    "scopedRegistries": [
    {
    "name": "spoiledcat",
    "url": "https://registry.spoiledcat.com",
    "scopes": [
    "com.spoiledcat"
    ]
    }
    ]
    }
     
  8. NoelStephens_Unity

    NoelStephens_Unity

    Unity Technologies

    Joined:
    Feb 12, 2022
    Posts:
    244
    Hmmm...you could have something in your packages-lock.json file in the same folder.
    Make a copy/backup of packages-lock.json and then delete that and see if that resolves the new issue.
    (the original fix-work-around suggested wasn't meant to be used as a downgrade)
     
    firebird721 likes this.
  9. firebird721

    firebird721

    Joined:
    Jun 8, 2022
    Posts:
    101
    1.71 works great! thx!
     
    NoelStephens_Unity likes this.
  10. NoelStephens_Unity

    NoelStephens_Unity

    Unity Technologies

    Joined:
    Feb 12, 2022
    Posts:
    244
    So your issue was resolved by using v1.7.1?
     
    firebird721 likes this.
  11. firebird721

    firebird721

    Joined:
    Jun 8, 2022
    Posts:
    101
    EXACTLY! THX