I want to patch a method like this:
public class DataManager : IDataProvider
{
protected virtual void ReadData<T>(string path) where T : Item
{
}
protected virtual void ReadData(string path)
{
}
……
}
I have written code like:
[HarmonyPrefix, HarmonyPatch(typeof(DataManager), "ReadData", new Type[] { typeof(string) })]
public static bool ModPatch_ReadData_Mod(ref DataManager __instance, string path)
{
return false;
}
However, when I run the game, the log is:
Patch HookModSupport Failed! Exception=HarmonyLib.HarmonyException: Ambiguous match for HarmonyMethod[(class=Heluo.Data.DataManager, methodname=ReadData, type=Normal, args=(string))] ---> System.Reflection.AmbiguousMatchException: Ambiguous match found.
So what can I do?