diff --git a/Assets/Mirage/Weaver/Processors/RpcProcessor.cs b/Assets/Mirage/Weaver/Processors/RpcProcessor.cs index c36a33eb72..093ba31bbc 100644 --- a/Assets/Mirage/Weaver/Processors/RpcProcessor.cs +++ b/Assets/Mirage/Weaver/Processors/RpcProcessor.cs @@ -305,7 +305,15 @@ protected ReturnType ValidateReturnType(MethodDefinition md, RemoteCallType call // UniTask is allowed var unitaskType = typeof(UniTask).GetGenericTypeDefinition(); if (returnType.Is(unitaskType)) + { + var genericReturnType = (GenericInstanceType)returnType; + var genericArg = genericReturnType.GenericArguments[0]; + // ensure serialize functions exist + _ = writers.GetFunction_Throws(genericArg); + _ = readers.GetFunction_Throws(genericArg); + return ReturnType.UniTask; + } throw new RpcException($"Use UniTask<{md.ReturnType}> to return values from [ClientRpc] or [ServerRpc]", md); }