Why things are working, and then unity modifies something, and things stops working ?
I’m exporting my project from unity 2019.3.0 (also tried with 2019.3.3) and then try to build it in Xcode but nope, an error with swift and it can’t be done.
The error I get : “Umbrella header ‘UnityFramework.h’ not found”
Anyone has an idea how to fix that ? I smell things are gonna be fun when I’m gonna start adding analytics and ads sdk.
Did you even drag that exact error into google? Because for me it lists a very specific step to try, and I would expect if you had tried that unsuccessfully, you might have mentioned it in your post above…
I finally managed to solve that problem. In my case, I had Swift-files in a plugin, but somehow the “Objective-C Generated Interface Header” wasn’t automatically generated. I don’t know, if the problem lies on the Unity or Xcode side. I followed these steps to get the build working:
Comment out every single reference to a Swift class
Temporarily remove the Target Membership “UnityFramework” from every Swift class
Clean and build the project
Readd the Target Membership “UnityFramework” to every Swift class
We are having the same issue here. Could you please elaborate on step 5? is this supposed to be included in the bridging header instead of UnityInterface.h?
You might not need this step. You only have to do this, if you are referencing any Swift-class within an Objective-C class. In order to get access to the Swift-classes you have to #import “UnityFramework/UnityFramework-Swift.h” at the top of the Objective-C class. Thats the “Objective-C Generated Interface Header” which wasn’t automatically generated and caused the umbrella error.
Hi @ElFarto , I was able to run the app directly from XCode to my test device by following your steps, but I got the same error when trying to Archive the project to upload to Appstore. Do you also have a workaround for that too?
Look in Unity-iPhone for the source of the error in the code. I think you will find main.mm to use the following: #include <UnityFramework/UnityFramework.h> — (it should show you an error)
Try to follow these steps from z000z’s post ( https://discussions.unity.com/t/771039/5 ):
Then if you do write that wrapper class, you’ll have to do a few more steps for it to work:
In the Xcode project go to Build Phases, select the UnityFramework Target, and then Drag the Headers section to the right under dependencies.
Add your wrapper objective-c header to the Headers section, and then drag to public.
Modify the UnityFramework.h to import your wrapper objective-c header, right above the UnityAppController import
That’s how I achived to archive the app. I’m not happy with that workaround at all, but at least I could build it…
Hi @ElFarto , Your solution didn’t work for me. I have a swift file which needs to be accessed in .mm file so, that I can access it in unity. I can import “UnityFramework/UnityFramework-Swift.h” on top of .mm file, But it doesn’t contain headers for my swift file.
Unity 2019.4.4f1 with Xcode 11.5
@aasiq I’ve been digging into this today on my project. You need to make sure your swift source files all target UnityFramework, comment out any use of #import “UnityFramework/UnityFramework-Swift.h” or any Swift classes in code, and get a successful build to make sure the UnityFramework-Swift.h header gets generated. Then uncomment the header, make sure you can build again, then uncomment swift calls. You’ll need to tag any classes / functions as @objc public if you want to use them in this file.
Is there any comprehensive documentation anywhere about the proper way to write a swift-based plugin wrapped to work with Unity? All I tend to find are references to approaches that used to work and threads (like this one) containing relatively obscure workarounds.
Is the state of Unity and the documentation really that sad?