mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
fix(weaver): Weaver finds correct log methods for unity 2020.2 (#2497)
Unity has added new private LogWarning methods in 2020.2 which causes weaver to find the wrong method. Checking the parameters as we as the name will find the correct method. fixes: https://github.com/vis2k/Mirror/issues/2366
This commit is contained in:
parent
613851ff3c
commit
50a214613f
@ -125,9 +125,22 @@ public static void SetupTargetTypes(AssemblyDefinition currentAssembly)
|
|||||||
|
|
||||||
registerCommandDelegateReference = Resolvers.ResolveMethod(RemoteCallHelperType, currentAssembly, "RegisterCommandDelegate");
|
registerCommandDelegateReference = Resolvers.ResolveMethod(RemoteCallHelperType, currentAssembly, "RegisterCommandDelegate");
|
||||||
registerRpcDelegateReference = Resolvers.ResolveMethod(RemoteCallHelperType, currentAssembly, "RegisterRpcDelegate");
|
registerRpcDelegateReference = Resolvers.ResolveMethod(RemoteCallHelperType, currentAssembly, "RegisterRpcDelegate");
|
||||||
|
|
||||||
TypeReference unityDebug = Import(typeof(UnityEngine.Debug));
|
TypeReference unityDebug = Import(typeof(UnityEngine.Debug));
|
||||||
logErrorReference = Resolvers.ResolveMethod(unityDebug, currentAssembly, "LogError");
|
// these have multiple methods with same name, so need to check parameters too
|
||||||
logWarningReference = Resolvers.ResolveMethod(unityDebug, currentAssembly, "LogWarning");
|
logErrorReference = Resolvers.ResolveMethod(unityDebug, currentAssembly, (md) =>
|
||||||
|
{
|
||||||
|
return md.Name == "LogError" &&
|
||||||
|
md.Parameters.Count == 1 &&
|
||||||
|
md.Parameters[0].ParameterType.FullName == typeof(object).FullName;
|
||||||
|
});
|
||||||
|
logWarningReference = Resolvers.ResolveMethod(unityDebug, currentAssembly, (md) =>
|
||||||
|
{
|
||||||
|
return md.Name == "LogWarning" &&
|
||||||
|
md.Parameters.Count == 1 &&
|
||||||
|
md.Parameters[0].ParameterType.FullName == typeof(object).FullName;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
TypeReference typeType = Import(typeof(Type));
|
TypeReference typeType = Import(typeof(Type));
|
||||||
getTypeFromHandleReference = Resolvers.ResolveMethod(typeType, currentAssembly, "GetTypeFromHandle");
|
getTypeFromHandleReference = Resolvers.ResolveMethod(typeType, currentAssembly, "GetTypeFromHandle");
|
||||||
|
Loading…
Reference in New Issue
Block a user