We're trying to include an XCFramework in our plugin for Unity. We're currently using Xcode 12, and Unity 2020.2. When building our project for iOS, we get the following error in Unity:
Plugin 'TestFairy.framework' is used from several locations:
Assets/Plugins/iOS/TestFairy.xcframework/ios-armv7_arm64/TestFairy.framework would be copied to <PluginPath>/TestFairy.framework
Assets/Plugins/iOS/TestFairy.xcframework/ios-i386_x86_64-simulator/TestFairy.framework would be copied to <PluginPath>/TestFairy.framework
Please fix plugin settings and try again.
UnityEditor.Modules.DefaultPluginImporterExtension:CheckFileCollisions (string)
UnityEditorInternal.PluginsHelper:CheckFileCollisions (UnityEditor.BuildTarget) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun () (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:124)
Obviously, it looks like Unity is picking up both frameworks in the XCFramework, however, we are curious to know if there's a way to have Unity filter out items from a Plugin based on architecture? We'd rather not delete the framework from the XCFramework, since we may need to switch between development on simulator and devices.
Perhaps through a custom PostProcessBuild
script? However, from what we can tell, the above error happens before the PostProcessBuild
can execute? Is there a way to hook into the PluginImporter
so we can define which framework to use?
From what we can tell, the issue may be resolved in 2021.2, based on this issue: https://issuetracker.unity3d.com/issues/ios-plugin-is-used-from-several-locations-error-when-building-a-project-with-included-xcframeworks
However, we're looking for a solution that would allow us to use an XCFramework for earlier versions of Unity.
question from:
https://stackoverflow.com/questions/65875561/plugin-framework-is-used-from-several-locations 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…