c# - 在 Unity 中重新启动/暂停/恢复 ARCore 会话
问题描述
如何在 ARCore 中暂停/恢复会话?我有一组画布,我经常在它们之间切换。这些画布中只有少数使用了 ARCore。
如何在这些画布中实现 ARCore 服务?
我还想在切换到其他画布时清除 ARCore 数据。
解决方案
目前 Unity 中没有其他方法可以暂停/恢复 ARCore 会话。
要在 Unity 中重新启动 ARCore 会话,您可以使用以下两种方法之一:Destroy(session)
或DestroyImmediate(session)
. 其中一种方法绝对适合您。
ARCoreSession session = goARCoreDevice.GetComponent<ARCoreSession>();
ARCoreSessionConfig myConfig = session.SessionConfig;
DestroyImmediate(session);
// Destroy(session);
yield return null;
session = goARCoreDevice.AddComponent<ARCoreSession>();
session.SessionConfig = myConfig;
session.enabled = true;
这是Object.DestroyImmediate()和Object.Destroy()函数的 Unity 文档。
推荐阅读
- asp.net - ASP.Net Core 3.1 - 使用视图模型上传文件总是为 NULL
- java - Appium 滚动动作发生两次
- php - 在 Ubuntu 16.04 服务器上安装特定的 PHP 版本
- qliksense - 我们可以通过 Rest API 从 Qlik sense 中提取数据吗?
- go - 如何检查一行或字符串是否包含作为 Golang 中的模板化变量?
- shell - 如何对具有日期和时间的时间戳的文件进行排序
- python - 如何自定义页面类型模型的 IndexView - Wagtail Admin 中的列表视图
- python-3.x - 如何在 Python 中检查来自文件的用户输入?
- go - 成功连接 webscoket 后如何向特定 URI 发送消息?
- c# - HTTPWebRequest - GetResponse() - 在 SSIS C# 脚本中被远程主机强制关闭