Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP: (0,0): error

Just updated Unity from LTS 2022.3.4f1 to LTS 2022.3.13f1 and I believe it also up updated Netcode from 1.6.1(?) to 1.7.0.

Now all the sudden getting an error I didn’t have before and I can’t figure it out. I’ve seen some discussion on deleting NetworkBehaviour scripts and recreating them to resolve the error but there are quite a few and don’t want to have to deal with this headache. Anyone know of any other fixes or have any suggestions?

Error:

  • Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP: (0,0): error - System.ArgumentNullException: Value cannot be null. (Parameter ‘method’)|| at Mono.Cecil.Cil.Instruction.Create(OpCode opcode, MethodReference method)|| at
  • Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[ ] assemblyDefines)|| at System.Collections.Generic.List1.ForEach(Action1 action)|| at
  • Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly) at Mono.Cecil.Cil.Instruction.Create(OpCode opcode, MethodReference method)|| at
  • Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[ ] assemblyDefines)|| at System.Collections.Generic.List1.ForEach(Action1 action)|| at
  • Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly)

I have the same error! It occurs if any RPC function exists in a class that inherits from a class with NetworkBehaviour


and BaseCounter:

If I remove the client and server RPC function from here, the error in my project disappears. I don’t know how to fix it yet.

Hi @edwardxperia2000 , this does sound like a recent regression bug that will be fixed in a future NGO update (hopefully v1.7.1).

The bug is that If you have multi-generation derived children of NetworkBehaviour where:

  • 2nd Generation Child: Has one or more ClientRpc or ServerRpc attribute decorated methods
  • 1st Generation Child: Has no ClientRpc or ServerRpc attribute decorated methods
  • Parent - NetworkBehaviour

This can result in an ILPP error that looks like the one you posted.

There are two ways to resolve this issue prior to the v1.7.1 NGO package update:

Option-1: Create place-holder Rpc

The bug encountered has an issue with a “middle generation” class not having any ClientRpc or ServerRpc attribute decorated methods. By adding a temporary Rpc (either ClientRpc or ServerRpc) to the 1st Generation Child (referencing the above example) it should resolve the issue.

When the user updates to NGO v1.7.1, they can remove the place-holder Rpc method(s).

Option-2: Temporarily Point Manifest to the release/1.7.1 branch
Replace your com.unity.netcode.gameobjects entry in Packages\manifest.json file with this:

"com.unity.netcode.gameobjects": "https://github.com/Unity-Technologies/com.unity.netcode.gameobjects.git?path=com.unity.netcode.gameobjects#release/1.7.1",

That branch includes the fix for that particular issue.

Does this help?

4 Likes

This totally solved the issue for me. Thumbs up sir!

2 Likes

Great! @ANLevant 1.7.1 was released today by the way, so you can update to it directly without referencing branches around

3 Likes

Solved by updating to newer version (1.7.1 in my case)

1 Like

Same here.

This error also occurs when I use [Rpc(SendTo.Server)] instead [ServerRpc] and ask for ServerRpcParams