将 Unity 应用程序嵌入到 UWP 应用程序中 [英] Embed Unity app into UWP Application

查看:51
本文介绍了将 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"容器,以便我可以查看 Unity 场景并与之交互.

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.

推荐答案

我有一个类似的问题,我想在 UWP 中将 Unity 与 XAML-UI 结合起来.对我有用的是 Unity 的 .NET 脚本后端.(您可以使用 Unity 下载助手进行安装,以防您在第一次安装 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-技术/windowsstoreappssamples/src

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

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

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