Is it possible to merge unity scenes with windows apps? - c#

I am working on a windows application for educational purposes.
My application consists of more than one window/page, each page has a specific job such as showing information, drawing and voice recognition.
Some pages/windows can only be done in Visual Studio windows apps (WPF or Windows store) such as pages with Kinect V2 functions.
However, there are some pages/windows that are much easier to do in Unity3D than in visual studio.
Is there a way to merge the unity 3D scenes windows app pages in one application?
The result I am looking for is a windows application (WPF or Store app) that consists of many pages, some of them are developed with visual studio and others developed with Unity engine.
Thanks for your help.

If you generate a Windows Store app from Unity it generates a Visual Studio Solution which you can then edit as desired. The Unity scene will run as a SwapChainPanel in the initial Xaml page. You can add your own Xaml and C# or C++ around it and can bridge between the Windows Runtime and Unity environments.
I haven't tried running multiple Xaml pages with Unity, but I expect it will work, although you may need to take care to keep Unity's environment stable. You may need to keep Unity's SwapChainPanel on a single page and manage different scenes for it within Unity rather than using separate Xaml pages for different scenes, and you probably need to start with Unity if you're using the free version so that the required splash-screen appears.
Another possibility--especially if Unity doesn't like having its SwapChainPanel messed with--would be to keep everything on one master Xaml page with the SwapChainPanel and a Frame containing the real Xaml pages.
If the only limit on using Unity is Kinect then there is a Kinect for Windows plug-in for Unity. It required the pro version of Unity 4, but not (I think) for Unity 5.

Related

Hololens 2 tap and head movement works in Unity but not on HoloLens

While building an app for the HoloLens 2 in Unity 2019, I started using MRTK (Mixed Reality Toolkit). I repeatedly ran into problems where the app would work perfectly, as expected in Unity while running the game preview. Once I built and deployed the app to an actual HoloLens 2, however, it would not run correctly.
At first, the app was in a window similarly to here. Then, once the window was removed, the app moved as if it was stuck to the user's face instead of staying still as the user moved around it. Finally, the hand and arm recognition did not work.
I followed all of the code examples, and I know my scripts are working because they work as expected in Unity. So what is wrong? Why does the app work in Unity but not on the HoloLens itself?
This took a lot of poking around and trial and error because the issues were not directly related to my code, but rather the configuration of MRTK. These problems were because of the transition between the (now) legacy XR (Mixed Reality) system in Unity, and the new XR system. If you followed the setup on this page, you are using the legacy XR system and will need to transition to the new system. Follow the steps here to transition between the systems. Also make sure to add a TrackedPoseDriver to the camera, as described here.
Note that starting in Unity 2020, the new XR management system will be the only option in Unity, so new projects started on that version going forward should not suffer this issue.
Hopefully this experience helps others avoid the same issues!

Using Windows Media Player with Windows Store App C++

I know it is somehow possible to implement a windows media player in a form with Visual C#.
The info for that is here: How to add the libraries and here How to code it.
But my project is in Visual C++ and I'm having a hard time finding how to do the same. It is a windows store application based on an example from a Hearth Rate Bluetooth monitor.
My goal is to play a video while the data acquisition occurs.
The answer is Windows Store App can't handle ActiveX controls. At least in a straightforward way.
The solution was to implement a MediaElement from the Toolbox into the XAML page. That element is easy to use with mediaElement.Play() and mediaElement.SetSource()

Can you put a Unity 3d game in a Xamarin cross platform app

Can you put a Unity 3d game in a Xamarin cross platform app?
I am developing a Game using Unity 3D, and I would like to include the game in my Xamarin Cross Platform App.
The Game is a mini game that I will give away free to customers who download and use my App.
Is this possible?
Can you put a Unity 3d game in a Xamarin cross platform app?
It depends.
Assuming you are not talking about browser games, Unity creates its own executable and/or entry point. You would probably have to take the Unity3D-created game and embed that as a resource in the original app, say a Windows Phone app. Then launch the game as a child process.
The original app:
You may be able to embed a Unity3D-created Windows phone app as a resource in an existing Windows Phone application. You could just spawn it as a child process?
Web Game
However, there is nothing stopping you from making a game in Unity3D and having it generate a web game.
Access complimentary build options for Web publishing in Unity 5. Once a user installs it, the hugely popular Unity Web Player plugin updates automatically. Use it to deploy to Internet Explorer, Safari, Mozilla Firefox and more. Tell me more
Your Xamaring app can then simply display a web browser from which you can play your game.
Browser Shell Apps
I see your "Merricks Jewelry" app is already on the iOS store. Be warned that should you pursue the web game approach, I know at one point Apple were strict at one point about native apps that were essentially shells for web-based content. You may need to check with Apple. It may still be the case or it may not.

Monogame tutorials /walkthroughs for normal Windows 7 development (not Windows 8, Android or iOS)

Can somebody point me to some good Monogame walkthroughs or tutorials?
The reason I am asking this question is because when I try to create a new project in VS2012, I get the following options
But all the tutorials or walkthroughs (like this one) have the following options and develop using xaml -
Now, I guess this is because I am using Windows 7. So can somebody give me tutorials that are actually targeted to my case.
NOTE: I am trying to develop simple and normal games for Windows 7, nothing fancy like XBox, Windows 8 or Android. Where can I find appropriate getting started walkthroughs for my situation?
There's a few MonoGame tutorials listed on the forums here:
https://monogame.codeplex.com/discussions/439595
And a related post about ideas for new MonoGame tutorials here:
https://monogame.codeplex.com/discussions/439728
As previously mentioned, the MonoGame API is syntactically compatible with XNA so most XNA tutorials will also be helpful.
There is some trickiness around dealing with content, the simplest method in my opinion is to just add it to the Content folder, set it to Content / Copy if newer in the properties window and refer to it with the file extension in code (unless it's an XNB file).
MonoGame is a great project and I highly recommend it if you want to make games for many platforms, something you may want to do sooner or later. However, it still has a few missing features compared to XNA so life may be easier in the short term, while you're learning if you stick with XNA.
Last point, your nearly there anyway, based on your first screenshot I would choose the MonoGame Windows OpenGL Project if you want to target windows 7. Learn how to render your first sprite and you may decide that proceeding with MonoGame is not so bad after all.
Most MonoGame tutorials will deal with Windows 8 or non-windows. This is because MonoGame was created as an alternative to XNA for easy porting from XNA-supported platforms (such as windows 7) to non-XNA supported platforms (such as a Windows Store App).
Note that you can still use XNA in Windows 8, but you'd be creating a desktop app, not a Windows Store App.
A great resource of example is the multi-platform sample project which contains several examples made to work on all platforms
https://github.com/Mono-Game/MonoGame.Samples
The platformer sample is on all platforms and the rest are in progress, but all show a great way to setup your project ready to tackle all the platforms out there!

Adding resources to forms in XNA

I'm new to XNA, however I managed to develop a pac man game. Now I'm trying to add some forms to the game to be used as a log in screen,but due to being an XNA project I can't add pictures to the form, any help pls?
Thx for your time
XNA doesn't work like WinForms, it isn't a GUI editor. Like you said, you can't add windows controls to a XNA application (unless you use a workaround, but that's not necessary for a login screen)
You'll need to use Game States to determine what to draw/update based on which menu you're currently in. The APP Hub has an example for that.

Categories