如何正确重新加载将MRTK用于Hololens2的Unity场景? [英] How do I properly reload a Unity Scene that uses MRTK for the Hololens2?

查看:135
本文介绍了如何正确重新加载将MRTK用于Hololens2的Unity场景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的第一个将Hololens和MRTK用于Unity的项目.我想制作一个按钮,当按下该按钮时可以重新启动播放器的体验.

This is my first project using the Hololens and MRTK for Unity. I want to make a button that restarts the experience for the player when pushed.

我使用以下代码将按钮连接到新脚本:

I connected a button to a new script with the following code:

SceneManager.LoadScene(SceneManager.GetActiveScene().name);

按下按钮时,场景似乎已重新加载,但是所有MRTK/Hololens功能都停止了.手部和眼睛的跟踪无响应,并且我无法与全息图互动.

When the button is pushed the scene seems to reload, but all MRTK/Hololens functionality stops. The hand and eye-tracking are unresponsive, and I am unable to interact with holograms.

我知道我可以手动创建一个reset方法,该方法可以移动场景中的所有对象并重置特定脚本,但是我试图通过按一下按钮来完全卸载并重新加载尽可能多的Unity应用程序.

I know I can manually make a reset method that moves all the objects in the scene and resets specific scripts, but I'm trying to completely unload and reload as much of the Unity application as possible from a push of a button.

那么,如何正确地在Hololens2上重新加载Unity场景?我仍在对此进行研究,并将更新我在此处找到的内容.非常感谢您的帮助,谢谢!

So, how do I properly reload a Unity Scene on the Hololens2? I'm still doing research on this and will update what I find here. I greatly appreciate any assistance here, Thank you!

推荐答案

MRTK实际上具有一个场景系统,该系统巧妙地包装了加载/卸载场景以及诸如照明之类的可选概念.

MRTK actually has a scene system that neatly wraps loading/unloading scenes as well as optional concepts like lighting.

在此处查看文档/指南: https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/SceneSystem/SceneSystemGettingStarted.html

Take a look at the docs/guides here: https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/SceneSystem/SceneSystemGettingStarted.html

这篇关于如何正确重新加载将MRTK用于Hololens2的Unity场景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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