RenderHeads / UnityPlugin-AVProMovieCapture

AVPro Movie Capture is a Unity Plugin for advanced video capture to AVI/MP4/MOV files
https://renderheads.com/products/avpro-movie-capture/
45 stars 8 forks source link

Support .xcframework for iOS including Simulator targets #328

Closed IgorLipovac closed 8 months ago

IgorLipovac commented 9 months ago

Is your feature request related to a problem? Please describe. When embedding Unity and AVProMovieCapture in iOS projects, it's very problematic to make things work in order to use SwiftUI previews (and iOS Simulator consequently). Having ability to not fight with linking and weird solutions to avoid this issue would greatly help users to develop faster while using AVProMovieCapture only for device builds.

Describe the solution you'd like Prepare a "mock" version of the framework that can successfully build for iOS Simulator, without the need to support the recording features, just make it run and not crash.

There are limitations on UnityFramework builds in general when it comes to Simulator for iOS, but those can also be mitigated to make it run. Having dependencies like AVProMovieCapture also ready for something like that, without having to insert linker flags and complicate Xcode projects, would be awesome!

MorrisRH commented 8 months ago

We've been investigating switching to using a .xcframework however this is a significant change and would not be a drop in update so we're inclined to hold back until the next major release where breaking changes are more tolerable.

It's also likely that we won't make this change until Unity support the iOS simulator on Apple Silicon.

IgorLipovac commented 8 months ago

Thanks for looking into this! Good advice to people that hit this issue, in order to make the simulator work now, is to make the .framework optional in linking setup (build phases in Xcode) and add a -weak_framework flag to Other Linker Flags + make sure that the iOS only code that you want to use in SwiftUI previews and simulator avoids importing UnityFramework and AVProMovieCapture .framework directly (use #if targetenvironment(simulator) compiler directives).