Process to set up Unity UWP project on top of a UWP C# blank project

Process to set up Unity UWP project on top of a UWP C# blank project
(At least that’s what I think I want to do…)

I’m a novice on this platform. I want to add a very short script to App.xaml.cs, following the official documentation for sending push notifications using Azure Notification Hubs. I’ve been unable to find such script in the Unity generated project, and I understand that’s because Unity generates an IL2CPP, which is a different thing.

I saw this thread from 2016 where a guy is doing what I want to do Azure Notifications Hub . He said he was able to set it up by following the official docs, but I’ve been unable to set up a “Blank App (Universal Windows)” project (which is what the official docs say). First I attempted to see if I could create it inside of the Unity generated project, but then I saw other threads where people seem add the Unity generated project to parent C# projects. I’m not sure if I want to do the former or the latter.

In brief, I want to set up what the guy on this thread seem to have done. That’s all because I want to add the following code to App.xaml.cs as per the official docs on Azure Notifications Hub. What’s the process to do this? I’m sure a lot of other people would benefit from knowing how to integrate their Unity projects with the UWP C# APIs.

PS. Alternatively, I’m not sure if what some people did here could be somehow an option. That is, to add the code I need inside of the Unity project scripts via #if ENABLE_WINMD_SUPPORT/#endif tags. (I do feel more interested in knowing how to edit a version of the App.xaml.cs file though.)

So you’re right, Unity doesn’t generate App.xaml.cs. It’s because Unity doesn’t generate a C# project: Unity generates a C++ project. You can find the equivalent file: App.xaml.cpp.

Now, it’s possible to convert this project to C# (and here’s an example of it being done: GitHub - TautvydasZilys/unity-uwp-il2cpp-with-csharp-project-example: This project demonstrates how to use IL2CPP scripting backend when you want final UWP application to use a C# project.), however, that has downsides. If you make it be a C# project, now you have two managed runtimes in your app: .NET and IL2CPP. That means you have two garbage collectors running and 2x the memory overhead. You have to take that into account when you decide you want to do it.