Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

unity3d - Embed Unity app into UWP Application

So I know it's possible to create a unity game and port - deploy it to the windows 10 store. but I have a different scenario (see below) that my boss wants but I've got no idea if this is even possible.

I need to create a UWP app and add a "unity 3d" container that allows me to view and interact with a unity scene.

I want to view a unity scene in the UWP app and have a list of assets, displayed in a listview within the UWP, based on the selected asset (within the UWP app), the scene should be updated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had a similar problem where I wanted to combine Unity with a XAML-UI in UWP. What worked for me was the .NET scripting backend for Unity. (You can install it with the Unity Download Assistant in case you missed it when installing Unity the first time.)

You create a new Unity project, go to "Player Settings" and set the property "Scripting Backend" to ".Net". Then you Build a UWP solution, and Unity generates you a .sln with the familiar UWP-structure (with files like App.xaml.cs, MainPage.xaml.cs and so on.) From these files, you can call your Unity scripts - and yes, you can also call code from xaml.cs in the unity scripts. The AppsCallbacksClass can be used to execute code on the AppThread(=Unity) or the UIThread(UWP).

Check out the Docs here (Scripting-Backend and AppCallbacks especially): https://docs.unity3d.com/Manual/WindowsStore.html

and the Xaml-Unity-Connection example here: https://bitbucket.org/Unity-Technologies/windowsstoreappssamples/src


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...