From 2ca8a90948f8878a518807f8ff8f160097f2ea31 Mon Sep 17 00:00:00 2001 From: Botao Hu Date: Fri, 10 Nov 2023 15:17:27 +0800 Subject: [PATCH] fix bugs for Apple plugins. Framework and Library cannot be embeded. https://github.com/apple/unityplugins/pull/20 and https://github.com/apple/unityplugins/pull/6 --- .../Editor/AppleFrameworkUtility.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Packages/com.apple.unityplugin.core/Editor/AppleFrameworkUtility.cs b/Packages/com.apple.unityplugin.core/Editor/AppleFrameworkUtility.cs index a4020cdac..fa0e6ed17 100644 --- a/Packages/com.apple.unityplugin.core/Editor/AppleFrameworkUtility.cs +++ b/Packages/com.apple.unityplugin.core/Editor/AppleFrameworkUtility.cs @@ -32,7 +32,9 @@ public static string GetPluginLibraryPathForBuildTarget(string libraryName, Buil return string.Empty; } - string[] results = AssetDatabase.FindAssets(libraryName); + string libraryNameWithoutExtension = Path.GetFileNameWithoutExtension(libraryName); + string[] results = AssetDatabase.FindAssets(libraryNameWithoutExtension); + foreach (string currGUID in results) { string libraryPath = AssetDatabase.GUIDToAssetPath(currGUID); @@ -136,7 +138,7 @@ public static void CopyAndEmbed(string source, BuildTarget buildTarget, string p { var expectedInstallPath = source.Substring(source.LastIndexOf(searchString) + searchString.Length); Debug.Log($"CopyAndEmbed - Expected install path for {frameworkName}: {expectedInstallPath}"); - fileGuid = pbxProject.FindFileGuidByProjectPath(Path.Combine("Frameworks", expectedInstallPath)); + fileGuid = pbxProject.FindFileGuidByProjectPath(Path.Combine(frameworkName.EndsWith(".a") ? "Libraries" : "Frameworks", expectedInstallPath)); if (string.IsNullOrEmpty(fileGuid)) { fileGuid = pbxProject.FindFileGuidByProjectPath(Path.Combine("Libraries", expectedInstallPath));