From 207ea9c1dc4117ab6c00e70290d5f7651fa906d8 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Sun, 27 Sep 2020 21:56:36 +0900 Subject: [PATCH] fix: in Unity 2018.x, sample import failed on Windows --- Packages/SoftMaskForUGUI/Scripts/Editor/ImportSampleMenu.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Packages/SoftMaskForUGUI/Scripts/Editor/ImportSampleMenu.cs b/Packages/SoftMaskForUGUI/Scripts/Editor/ImportSampleMenu.cs index 56d73c5..c685a96 100644 --- a/Packages/SoftMaskForUGUI/Scripts/Editor/ImportSampleMenu.cs +++ b/Packages/SoftMaskForUGUI/Scripts/Editor/ImportSampleMenu.cs @@ -25,11 +25,12 @@ private static void ImportTextMeshProSupport() private static void ImportSample(string jsonGuid, string sampleName) { var jsonPath = AssetDatabase.GUIDToAssetPath(jsonGuid); + var packageRoot = Path.GetDirectoryName(jsonPath).Replace('\\', '/'); var json = File.ReadAllText(jsonPath); var version = Regex.Match(json, "\"version\"\\s*:\\s*\"([^\"]+)\"").Groups[1].Value; var displayName = Regex.Match(json, "\"displayName\"\\s*:\\s*\"([^\"]+)\"").Groups[1].Value; - var src = string.Format("{0}/Samples~/{1}", Path.GetDirectoryName(jsonPath), sampleName); - var srcAlt = string.Format("{0}/Samples/{1}", Path.GetDirectoryName(jsonPath), sampleName); + var src = string.Format("{0}/Samples~/{1}", packageRoot, sampleName); + var srcAlt = string.Format("{0}/Samples/{1}", packageRoot, sampleName); var dst = string.Format("Assets/Samples/{0}/{1}/{2}", displayName, version, sampleName); var previousPath = GetPreviousSamplePath(displayName, sampleName);