Skip to content

Commit

Permalink
fix: rpcs for fixing IL2CPP
Browse files Browse the repository at this point in the history
casting NetworkBehaviour argument to the current type incase the method fixes an il2cpp issue where it couldn't automaticaly convert
  • Loading branch information
James-Frowen committed Feb 7, 2022
1 parent e760a86 commit e574a80
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions Assets/Mirage/Weaver/Processors/ClientRpcProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ MethodDefinition GenerateSkeleton(MethodDefinition md, MethodDefinition userCode
ILProcessor worker = rpc.Body.GetILProcessor();

worker.Append(worker.Create(OpCodes.Ldarg_0));
worker.Append(worker.Create(OpCodes.Castclass, md.DeclaringType));

// NetworkConnection parameter is only required for RpcTarget.Player
RpcTarget target = clientRpcAttr.GetField(nameof(ClientRpcAttribute.target), RpcTarget.Observers);
Expand Down
1 change: 1 addition & 0 deletions Assets/Mirage/Weaver/Processors/ServerRpcProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ MethodDefinition GenerateSkeleton(MethodDefinition method, MethodDefinition user

// load `behaviour.`
worker.Append(worker.Create(OpCodes.Ldarg_0));
worker.Append(worker.Create(OpCodes.Castclass, method.DeclaringType));

// read and load args
ReadArguments(method, worker, readerParameter, senderParameter, false, paramSerializers);
Expand Down

0 comments on commit e574a80

Please sign in to comment.