Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved [NetCode] Generated NetCode Method is Inaccessible from NetCode

Discussion in 'NetCode for ECS' started by florianhanke, Jan 11, 2021.

  1. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    As soon as I'm using a SendRpcCommandRequestComponent, I get the following error:
    Code (Text):
    1. MethodAccessException: Method `Networking.Generated.BUDNetworkingRpcCommandsGoInGameRequestCommandSerializer+InvokeExecute_00000053$BurstDirectCall.Invoke(Unity.NetCode.RpcExecutor/Parameters&)' is inaccessible from method `Networking.Generated.BUDNetworkingRpcCommandsGoInGameRequestCommandSerializer.InvokeExecute(Unity.NetCode.RpcExecutor/Parameters&)'
    2. Networking.Generated.BUDNetworkingRpcCommandsGoInGameRequestCommandSerializer.InvokeExecute (Unity.NetCode.RpcExecutor+Parameters& parameters) (at Assets/NetCodeGenerated/Networking.Generated/BUD.Networking.RpcCommands.GoInGameRequestCommandSerializer.cs:29)
    3. Unity.NetCode.RpcSystem+RpcExecJob.Execute (Unity.Entities.ArchetypeChunk chunk, System.Int32 chunkIndex, System.Int32 firstEntityIndex) (at Library/PackageCache/com.unity.netcode@0.5.0-preview.5/Runtime/Rpc/RpcSystem.cs:301)
    These are calls from within NetCode to NetCode generated code – using NetCode 0.5.0-preview.5. What could be the issue? (Unsure where to look)

    I'm using the following IRpcCommand:
    Code (CSharp):
    1. public struct GoInGameRequestCommand : IRpcCommand
    2. {
    3. }
    with this
    Code (CSharp):
    1. [UpdateInGroup(typeof(ClientSimulationSystemGroup))]
    2. public class GoInGameClientSystem : ComponentSystem
    3. {
    4.     protected override void OnCreate() { }
    5.  
    6.     protected override void OnUpdate()
    7.     {
    8.         Entities.WithNone<NetworkStreamInGame>().
    9.                  ForEach(
    10.                          (Entity ent, ref NetworkIdComponent id) =>
    11.                          {
    12.                              PostUpdateCommands.AddComponent<NetworkStreamInGame>(ent);
    13.                              var req = PostUpdateCommands.CreateEntity();
    14.                              PostUpdateCommands.AddComponent<GoInGameRequestCommand>(req);
    15.                              PostUpdateCommands.AddComponent(
    16.                                                              req,
    17.                                                              new SendRpcCommandRequestComponent
    18.                                                                  { TargetConnection = ent }
    19.                                                             );
    20.                          }
    21.                         );
    22.     }
    23. }
    (basically the Getting Started code)
     
  2. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    The issue was that I was too far ahead with my Burst version: 1.5.0-pre.3. Going back to 1.4.3 helped.