diff --git a/Assets/AndroidIl2cppPatchDemo/Script/VersionSettor.cs b/Assets/AndroidIl2cppPatchDemo/Script/VersionSettor.cs index 2915741..041c5cb 100644 --- a/Assets/AndroidIl2cppPatchDemo/Script/VersionSettor.cs +++ b/Assets/AndroidIl2cppPatchDemo/Script/VersionSettor.cs @@ -27,11 +27,21 @@ public void OnClickSetVersion() if (!string.IsNullOrEmpty(error)) { messageBox.Show("use failed. empty path error:" + error, "ok", ()=> { messageBox.Close(); }); + return; } - else + + string cacheDir = Application.persistentDataPath + "/il2cpp"; + if (Directory.Exists(cacheDir)) + { + DeleteDirectory(cacheDir); + } + + if (Directory.Exists(cacheDir)) { - StartCoroutine(Restart()); + messageBox.Show("failed to delete pre Unity cached file. path:" + cacheDir, "ok", () => { messageBox.Close(); }); + return; } + StartCoroutine(Restart()); return; } StartCoroutine(PreparePatchAndRestart());