Google VR Unity Divider, Settings and Back button hiding in v0.9

你。 提交于 2019-12-01 21:58:58

问题


Does anyone know how to disable the Divider, settings and back button in the latest google vr sdk for unity?

I've tried setting NativeUILayerSupported to false and putting a return in the legacy DrawUILayer but it still shows.

It appears that the older ways of doing it are now fully deprecated.


回答1:


For iOS try to change following: In Unity, Plugins/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;
}



回答2:


@PerryHart i was stuck in same problem while using Google VR SDK. Problem is in latest versions of GVR SDK there is no interfacing to disable buttons and other UI Layers. But Google VR SDK 0.8 and less then 0.8 gives interface through which you can do it easily.

To disable these layers from code is quiet complex and i lost my 2 weeks to do this stuff through code in version GVR 1.xx.

You can download Google VR SDK 0.8.1 from here.




回答3:


Try to disable the settings on your Cardboard script under UI Layer Settings to false.

Do this from the interface and not from code.




回答4:


I am using the Google VR SDK for Android not the Google VR Unity and this is my solution:

In android, the deprecated method to hide two buttons is

// called by VrView
setSettingsButtonEnabled(false);

Since now can't use it, so just find this two buttons and hide it myself:

findViewById(R.id.ui_back_button).setVisibility(GONE);
findViewById(R.id.ui_settings_button).setVisibility(GONE);



回答5:


My Scenario :

  • Gvr-Ar App with Gvr for just The Gyroscope (Gvr Eyes aint Rendering a thing, using own Cameras)
  • Commented the Whole Post Renderer Class ( wich also means i dont have lens disortion calculated, and can use the full screen without the lens shape on the cameras)

What worked for me ( using gvr 1.3 ) :

go into the AndroidDevice.cs Script and comment the Following Lines marked with some ###

// 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

I have a wierd Scenario, so if you have the vr mode enabled and this does not work you could try also commenting the body of the SetVRModeEnabled() Function



来源:https://stackoverflow.com/questions/39433089/google-vr-unity-divider-settings-and-back-button-hiding-in-v0-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!