在 Unity3D 中嵌入 Cardboard 配置文件

Embedding Cardboard profile in Unity3D

我想避免用户必须扫描带有 Cardboard Viewer 配置文件的 QRCode,这样他们就可以将设备放入查看器并准备就绪。查看器配置是不变的,我有一个配置文件 URL。是否可以在 Unity3D 中启动应用程序时加载此配置文件?如果可以,我应该怎么做?

我尝试通过在附加到相机的脚本的开头加载以下代码行来设置它,但没有成功:

Cardboard.SDK.DefaultDeviceProfile = new Uri(SpecificVRViewerProfileUrl);

我正在使用 Unity 5.3.1f1、Cardboard 0.6 和 Vuforia。

我没用过cardboard的Unity SDK,只用过java,但是看了示例(https://github.com/googlesamples/cardboard-unity/blob/master/Cardboard/Scripts/Cardboard.cs) you might want to try getting a device reference using BaseVRDevice. It's a class also in the samples (https://github.com/googlesamples/cardboard-unity/blob/master/Cardboard/Scripts/VRDevices/BaseVRDevice.cs)

// The VR device that will be providing input data.
private static BaseVRDevice device;

device = BaseVRDevice.GetDevice();
device.Init();

然后使用此设置设备配置文件而不是 Cardboard.SDK.SetDefaultDeviceProfile

public Uri DefaultDeviceProfile = new Uri("your URL here");
if (DefaultDeviceProfile != null) {
  device.SetDefaultDeviceProfile(DefaultDeviceProfile);
}