Hello forum,
This post is loosely related to another one i did in the winter ( Integrating Unity inside of an existing UWP app. )
We currently have a pipeline that allows unity to be placed inside an existing uwp app but it’s quite convoluted and also depends on the .NET scripting backend.
I wish to RnD my way out of the deprecation of .net scripting backend and somehow find a solution that will work with il2cpp.
Current pipeline:
- From the unity sources, create a unity c# xaml build.
- Build and run from visual studio (the run step is to create the Appx folder inside the bin\x64 folder)
- Copy all relevant DLLs (a bunch of them) into a folder in the main app project repo.
- The actual UWP target app has references to all the unity engine dlls and AssemblyCSharp.dll (basically it’s similar to the one that is created in a regular .sln build from unity)
- The Data folder is copied in the main app and is set to Content
Notes: In the main UWP app, we activate unity with code that’s similar to the one in the output c# project
var bridge = new ScriptingBridge();
var appCallbacks = AppCallbacks.Instance ?? new AppCallbacks();
appCallbacks.SetBridge(bridge);
appCallbacks.SetSwapChainPanel(SwapChainHolder.SwapChain);
appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
appCallbacks.InitializeD3DXAML();
appCallbacks.RenderingStarted += AppCallbacks_RenderingStarted;
As I’m looking to optimizing and future proofing this, il2cpp seems the way to go.
My main hurdle is interop. Our app needs to call stuff from unity (let’s say to trigger an animation, but that’s an oversimplification). I’ve yet to find a way to get this working without going into C++. Seems like that’s not going to fly, as I’ve seen as a response to my initial post.
Being that my project is not store-deployed, I am able to do some hacky out of the way stuff, so if there is anything you guys here know, let’s say to instantiate unity in a process and get the framebuffer and render it in a swapchain within uwp, i’m open to anything.
Thanks