将Unity应用嵌入UWP应用 [英] Embed Unity app into UWP Application

查看:381
本文介绍了将Unity应用嵌入UWP应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我知道可以创建一个统一的游戏和端口-将其部署到Windows 10商店.但老板有我想要的另一种方案(见下文),但我什至不知道这是否有可能.

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.

我需要创建一个UWP应用并添加一个"unity 3d"容器,该容器可以让我查看统一场景并与之交互.

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

我想在UWP应用程序中查看一个统一的场景,并根据所选资产(在UWP应用程序内)在UWP的列表视图中显示资产列表,该场景应进行更新.

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.

推荐答案

我遇到了类似的问题,我想将Unity与UWP中的XAML-UI结合使用. 对我有用的是Unity的.NET脚本后端. (您可以使用Unity Download Assistant进行安装,以防第一次安装Unity时错过它.)

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.)

您创建一个新的Unity项目,转到播放器设置",并将属性脚本后端"设置为".Net".然后,构建一个UWP解决方案,Unity会为您生成一个具有熟悉的UWP结构的.sln(带有App.xaml.cs,MainPage.xaml.cs等文件).从这些文件中,您可以调用Unity脚本-是的,您还可以在统一脚本中从xaml.cs调用代码. AppsCallbacksClass可用于在AppThread(= Unity)或UIThread(UWP)上执行代码.

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).

在此处签出文档(尤其是脚本后端和AppCallbacks): https://docs .unity3d.com/Manual/WindowsStore.html

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

和此处的Xaml-Unity-Connection示例: https://bitbucket.org/Unity -Technologies/windowsstoreappssamples/src

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

这篇关于将Unity应用嵌入UWP应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆