Unity-Technologies / com.unity.netcode.gameobjects

Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.
MIT License
2.1k stars 430 forks source link

no matching function for call to 'NetworkBehaviour___beginSendRpc_...' #2817

Open nezbite opened 5 months ago

nezbite commented 5 months ago

Description

When building a project using [Rpc(SendTo.***)] with NGO 1.8.0, the build in Xcode fails with this error for every Rpc in the Project:

buildPath/Il2CppOutputProject/Source/il2cppOutput/Assembly-CSharp.cpp:5925:9 no matching function for call to 'NetworkBehaviour___beginSendRpc_mD9AE8C915F9ECD278DAF43F4A0FA318DEE1851D1'

buildPath/Il2CppOutputProject/Source/il2cppOutput/Assembly-CSharp.cpp:5929:3 no matching function for call to 'NetworkBehaviour___endSendRpc_mF8317FAAFD02F96495DF44EFAED5F1DEB716465E'

Reproduce Steps

  1. Create a Project with NGO (1.8.0), MultiplayerTools, Unity Transport
  2. Add RPCs with [Rpc(SendTo.Server)] or [Rpc(SendTo.Everyone)]
  3. Build for iOS
  4. Build in Xcode

Actual Outcome

Xcode reports a build failure with an error for every RPC in the code two messages that looks like this

buildPath/Il2CppOutputProject/Source/il2cppOutput/Assembly-CSharp.cpp:5925:9 no matching function for call to 'NetworkBehaviour___beginSendRpc_mD9AE8C915F9ECD278DAF43F4A0FA318DEE1851D1'

buildPath/Il2CppOutputProject/Source/il2cppOutput/Assembly-CSharp.cpp:5929:3 no matching function for call to 'NetworkBehaviour___endSendRpc_mF8317FAAFD02F96495DF44EFAED5F1DEB716465E'

Expected Outcome

The Project builds normally and runs in iOS as it does work in the Editor and as a Standalone build.

Screenshots

grafik

Example RPC function:

grafik

Environment

nezbite commented 4 months ago

For anyone having the same problem, changing all [Rpc(SendTo.Everyone)] RPCs to [ClientRpc] and [Rpc(SendTo.Server)] RPCs to [ServerRpc] etc. works for me. The game now builds in Xcode and runs fine on iPhone. Just make sure to include [ServerRpc(RequireOwnership = false)] where necessary. This works as a workaround for now.

MiTschMR commented 4 months ago

I have the same issue by building for the IL2CPP backend for Windows, used Unity version is 2022.3.0f1 (due to me being an assetstore developer staying on a fixed version), though I doubt it is because of that.

Stacktrace for one of the errors, though I can't say whether or not the complaining method uses SendTo.Everyone or SendTo.Server as both are used in the script:

<Path to project>\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\MiTschMR.Runtime.EasyUGS.NetCode.cpp(8275): error C2664: 'void NetworkBehaviour___endSendRpc_mF8317FAAFD02F96495DF44EFAED5F1DEB716465E(NetworkBehaviour_t1F9CC6E5B76D29ECECBB61F02D8E8EDE24CDDDCE *,FastBufferWriter_tE6AFE9436BD125AF309056A81B70F95625FB96EC *,uint32_t,RpcParams_t230EE00CD9A98836455C756E14F0C575971412FD,RpcAttributeParams_t6E0FB11B1FB4F668145B301D80D4518BF17136DC,int32_t,int32_t,const RuntimeMethod *)': cannot convert argument 4 from '__RpcParams_tA4F5B2601A930BA667C4084C62B0FA7CABA5980E' to 'RpcParams_t230EE00CD9A98836455C756E14F0C575971412FD'
<Path to project>\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\MiTschMR.Runtime.EasyUGS.NetCode.cpp(8275): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
<Path to project>\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\MiTschMR.Runtime.EasyUGS.NetCode.cpp(4224): note: see declaration of 'NetworkBehaviour___endSendRpc_mF8317FAAFD02F96495DF44EFAED5F1DEB716465E'
<Path to project>\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\MiTschMR.Runtime.EasyUGS.NetCode.cpp(8275): note: while trying to match the argument list '(NetworkPlayer_t055850ECE976B9E4BA87088FF5F4252B2B9A83EC *, FastBufferWriter_tE6AFE9436BD125AF309056A81B70F95625FB96EC *, int, __RpcParams_tA4F5B2601A930BA667C4084C62B0FA7CABA5980E, RpcAttributeParams_t6E0FB11B1FB4F668145B301D80D4518BF17136DC, int, int, int)'
ShadauxCat commented 4 months ago

A fix for this issue has been identified and we are preparing to put out a patch release to address it as quickly as possible. Our release process can take a few days, but a release should hopefully be out within the next week.

For anyone having the same problem, changing all [Rpc(SendTo.Everyone)] RPCs to [ClientRpc] and [Rpc(SendTo.Server)] RPCs to [ServerRpc] etc. works for me. The game now builds in Xcode and runs fine on iPhone. Just make sure to include [ServerRpc(RequireOwnership = false)] where necessary. This works as a workaround for now.

@nezbite Just as a note, SendTo.Everyone and ClientRpc do not exactly match. They will match when running in host mode, but with a dedicated server, SendTo.Everyone sends to the server, while ClientRpc does not. The SendTo option that matches ClientRpc's behavior is SendTo.ClientsAndHost.

trigaten commented 4 months ago

Thank you for posting this, I couldn't find the issue anywhere online!