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
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:
Is there any chance that you’re still using the ServerRpcParams? An error will be thrown when using the [Rpc(SendTo.Server)] with ServerRpcParams. If you replace the ServerRpcParams with RpcParams then the error should resolve itself.
If that’s not the issue, do you mind posting the error message you’re seeing?
Could you provide:
The version of NGO you are using.
The error message you are getting.
If the error message is not the same as the one originally posted, could you also provide what is happening when the message occurs and if you have scene management enabled?
You might look at GitHub Issue #3742, was recently resolved and will be in the next update, to see if you are getting a similar exception.