有谁知道如何在最新的谷歌vr sdk中禁用分频器,设置和后退按钮以实现统一?
我已经尝试将NativeUILayerSupported设置为false并在旧版DrawUILayer中放置一个返回但它仍然显示。
现在似乎已经完全弃用了旧的方法。
对于iOS尝试更改以下内容:在Unity,插件/ iOS / CardboardAppController.mm - >
@implementation CardboardAppController
- (UnityView *)createUnityView {
UnityRegisterViewControllerListener(self);
UnityRegisterAudioPlugin(UnityGetAudioEffectDefinitions);
UnityView* unity_view = [super createUnityView];
//createUiLayer(self, (UIView *)unity_view); <- comment this line
return unity_view;
}
@PerryHart我在使用Google VR SDK时遇到了同样的问题。问题出在最新版本的GVR SDK中,没有禁用按钮和其他UI图层的接口。但谷歌VR SDK 0.8和小于0.8提供了接口,您可以通过它轻松地完成它。
要从代码中禁用这些图层是非常复杂的,我通过版本GVR 1.xx中的代码丢失了我的2周时间来完成这些工作。
尝试禁用“UI层设置”下的Cardboard脚本上的设置为false。
从界面而不是代码执行此操作。
我使用的是Google VR SDK for Android而不是Google VR Unity,这是我的解决方案:
在android中,隐藏两个按钮的已弃用方法是
// called by VrView
setSettingsButtonEnabled(false);
由于现在无法使用它,所以只需找到这两个按钮并自己隐藏它:
findViewById(R.id.ui_back_button).setVisibility(GONE);
findViewById(R.id.ui_settings_button).setVisibility(GONE);
我的场景:
什么对我有用(使用gvr 1.3):
进入AndroidDevice.cs脚本并注释标有一些###的以下行
// Copyright 2015 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#if UNITY_ANDROID && !UNITY_HAS_GOOGLEVR
using UnityEngine;
/// @cond
namespace Gvr.Internal {
public class AndroidDevice : GvrDevice {
// private const string ActivityListenerClass = ######
// "com.google.vr.platform.unity.UnityVrActivityListener"; ######
private static AndroidJavaObject activityListener;
public override void Init() {
SetApplicationState();
base.Init();
ConnectToActivity();
}
protected override void ConnectToActivity() {
base.ConnectToActivity();
if (androidActivity != null && activityListener == null) {
// activityListener = Create(ActivityListenerClass); #####
}
}
public override void SetVRModeEnabled(bool enabled) {
CallObjectMethod(activityListener, "setVRModeEnabled", enabled);
}
public override void ShowSettingsDialog() {
// CallObjectMethod(activityListener, "launchConfigureActivity"); #####
}
public override void OnPause(bool pause) {
base.OnPause(pause);
CallObjectMethod(activityListener, "onPause", pause);
}
private void SetApplicationState() {
if (activityListener == null) {
// using (var listenerClass = GetClass(ActivityListenerClass)) { ###
// CallStaticMethod(listenerClass, "setUnityApplicationState"); ###
// } #####
}
}
}
}
/// @endcond
#endif // UNITY_ANDROID && !UNITY_HAS_GOOGLEVR
我有一个奇怪的场景,所以如果您启用了vr模式并且这不起作用,您可以尝试也注释SetVRModeEnabled()函数的主体