Unity 设备门户让您可以直接从 Unity Editor 中构建通用 Windows 平台 (UWP) 应用程序并直接在远程 Window 10 设备(如 HoloLens)上运行,而无需生成 Visual Studio 项目。这意味着在测试 Unity 项目时可以进行更快的迭代。
此功能仅适用于 UWP,不能用于 Windows 独立平台播放器。
要使用 Windows 设备门户部署,您需要对 Windows 设备门户有所了解。有关更多信息,请参阅 Microsoft 的 Windows 设备门户文档。
要访问设备门户设置,请执行以下操作:
打开 Build Settings(菜单:__File > Build Settings__)。
在 Platform 列表中,选择 Universal Windows Platform。
导航到 Build and Run on 属性,然后从下拉选单中选择 Remote Device (via Device Portal)。
注意:您可以在设备门户部署中使用 Executable Only 构建类型。这使得像 HoloLens 这样的设备的迭代速度加快。
现在,可以输入以下设备门户参数:
设置 | 功能 |
---|---|
Device Portal Address | 输入设备门户的 IP 地址和端口号。可从 Windows 开发者设置中访问此参数(请参阅下文中的获取设备门户地址)。 |
Device Portal Username | 输入设备门户的用户名。如果启用 WDP 身份验证,则此设置是可选的。 |
Device Portal Password | 输入设备门户的密码。如果启用 WDP 身份验证,则此设置是可选的。 |
Unity 将 Device Portal Address 和 Device Portal Username 字段保存在项目设置中。出于安全原因,Unity 不会保存您的设备门户密码,因此有时您可能需要重新输入该密码(通常是在重新启动 Editor 或加载新项目时)。
要获取设备门户地址,请找到 Windows 开发者设置并导航到 Connect using__(请参阅下面的截屏)。查找要用于将 Editor 连接到远程设备的连接类型。复制连接地址字符串(完全按照 Windows 开发者设置中显示的字符串),然后将该字符串输入到 Unity Build Settings__ > Build configuration > Device Portal Address 字段中。此地址包含 IP 地址和端口号。
例如,在以下截屏中:
Wi-Fi 地址为 http://10.1.163.217:50080
localhost 地址为 http://localhost:50080
在完成了 UWP 设备门户的设置后,单击 Build and Run。此时将构建 UWP 应用程序,将应用程序部署到远程设备,然后启动应用程序。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.