public MethodBase FindBestOverloadFunction(MethodBase[] methods, List <System.Type> methodArgs, bool checkIfInUdon = true) { if (methods.Length == 0) { throw new System.ArgumentException("Cannot find overload from 0 length method array"); } List <MethodBase> validMethods = new List <MethodBase>(); foreach (MethodBase method in methods) { ParameterInfo[] methodParams = method.GetParameters(); bool isMethodValid = true; for (int i = 0; i < methodParams.Length; ++i) { ParameterInfo currentParam = methodParams[i]; // Check method arg count if (i >= methodArgs.Count && !currentParam.HasDefaultValue) { isMethodValid = false; break; } else if (currentParam.HasDefaultValue) { continue; } System.Type argType = methodArgs[i]; if (!currentParam.ParameterType.IsImplicitlyAssignableFrom(argType) && !currentParam.HasParamsParameter() && !currentParam.ParameterType.IsByRef) { // Handle implicit upcasts to int from lower precision types if (method is OperatorMethodInfo operatorParam && (operatorParam.operatorType == BuiltinOperatorType.LeftShift || operatorParam.operatorType == BuiltinOperatorType.RightShift) && (argType != typeof(uint) && argType != typeof(ulong) && argType != typeof(long))) { if (UdonSharpUtils.GetNumericConversionMethod(currentParam.ParameterType, argType) == null) { isMethodValid = false; break; } } else { isMethodValid = false; break; } }