Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

Unity 5.6 does not work with latest GVRSDK (android build problems) #524

Closed
synthercat opened this issue Apr 5, 2017 · 21 comments
Closed

Comments

@synthercat
Copy link

synthercat commented Apr 5, 2017

I just finished a 5-hour investigation on this matter

To make long story short : DO NOT USE UNITY 5.6. It does not go well with Google VR SDK

The long story :
In most cases... it seems to work fine (on the editor) but it does not build fine
Way to reproduce problem :

  1. Start an empty 3d project
  2. Switch platform to android
  3. Import the latest Google VR SDK
  4. Set audio spatializer as GVR audio spatializer
  5. Set proper package name, minimum API 19, landscape left
  6. Try to build...

In general there are a bunch of problems related to 5.6
I tried all kinds of combo such as

  • GVR 1.0.3
  • First importing then switching
  • manifest editing
  • Opening existing projects
  • GVR Spatializer or none
  • Tried different Android SDK build tools

Problems that I had to solve in various combinations of the conditions mentioned above :

  • Obsolete plug-in files that asked for deletion
  • re-compression errors
  • Manifest merge issues
  • Manifest that asked for cardboard/daydream related parts to be manually edited
  • Problems with API settings in player settings
    Even solving all the above didn't provide with a proper build. I had variations like a build that would run as if were non-VR app, to crashes... etc

I can't believe that 5 days after the official release of 5.6 and all this info does not exist anywhere on the internet (until this post that is!)

I will wait your findings

@guneyozsan
Copy link

Did you enable native VR and add Cardboard or Daydream to VR platforms in Player Settings? Because when you enable native VR you won't be able to set landscape left as you mentioned. Unity 5.6 doesn't support non-native integration as in prior versions of Google VR, it is not backwards compatible. You have to use native support, otherwise it won't work on Android.

I only had manifest merge issues when I updated Google plugin or Unity, which was always resolved by deleting Google SDK and all of its files in the Plugins directory (including manifests) and reimporting it.

Instead of reimporting the SDK, pulling the manifest files that used to work before the update from the repo, and replacing the updated manifests also worked.

Also be sure not to have an AndroidManifest.xml file but only AndroidManifest-Cardboard.xml and AndroidManifest-Daydream.xml in Plugins/Android.

@synthercat
Copy link
Author

synthercat commented Apr 5, 2017

No I didn't.. you are not supposed to use native SDK together with Google VR SDK asset
Weird... the combo of native + external asset does produce better result

@cdepace
Copy link

cdepace commented Apr 5, 2017

I confirm that the problem occurs with iOS too, I have been getting crazy for over a week posting in every forum. The only solution was to remove the SDK and go native (with all the limitations implied). http://answers.unity3d.com/questions/1333075/project-runs-in-unity-but-fails-when-building-for.html

@guneyozsan
Copy link

@synthercat I agree it sounds a bit weird but you need to both install Google VR SDK and use native SDK starting with Unity 5.6. Native side takes care of the rendering but pointer and controller stuff is still handled by Google VR SDK. Perhaps there may be other things like that.

For iOS we need to wait for 1.40 unless you want to dive into crazy hacks. Unity removed backwards compatibility and iOS side is lagging behind.

@batchku
Copy link

batchku commented Apr 6, 2017

I'm running into similar issues as @synthercat in trying to work with the simple "GVRDemo" from the latest gvr-unity-sdk, with Unity 5.6f3. I'm trying to look at an example scene in the SDK and build it to an android device for Cardboard use.

Here is my process:

  • Open Unity 5.6f3; create a new project
  • Assets > Import Package... > Custom Package.... and select "GoogleVRForUnity.unitypackage"
  • Import everything
  • Change player settings to enable "Virtual Reality Supported"
  • add "Cardboard" under "
  • Open this scene "GoogleVR>Demos>Scenes>GVRDemo"; press Play in Unity

Problems:

  • I get an error in the game window that says To use the controller, please upgrade to a version of Unity with the GVR native integration. Isnt Unity 5.6f3 the latest version and doesn't it have native GVR integration?
  • I'm not able to move around with the mouse; shouldn't I be able to do that, for CardBoard?

Also, @guneyozsan : what do you mean by you have to "both install Google VR SDK and use native SDK starting with Unity 5.6"? I understand importing the GoogleVR SDK, but how do you "install native SDK"? what native SDK?

thank you!

@guneyozsan
Copy link

@batchku Your app is working fine. You can simulate head with Alt+mouse or Ctrl+mouse and click around.

The message in the game window is just a warning that you don't have a Daydream controller (a separate device with buttons that you hold in your hands).

When you click "Virtual Reality Supported" you use native SDK embedded in Unity. Before 5.6 you had to disable "VR Supported" option and use imported Google SDK instead but with 5.6 you have to enable it but still use Google SDK. What we discuss is the expected behavior when you enable native SDK in Unity is you shouldn't need to import also the Google VR SDK. This seems to create some confusion for people who started development before native support in Unity.

@batchku
Copy link

batchku commented Apr 6, 2017

@guneyozsan thank you; that is helpful. I can confirm that I am indeed able to run the demo GVRDemo scene now.

Here is a question:
Previously, in our app we'd built our own reticle; this was working well until 5.6f3, but with this version the reticle interaction is not working. It continues to work on Unity on a computer, but when it's deployed to an Android, the reticle doesn't seem to recognize objects anymore from its raycasting. I'd like to move this app to use the reticle in the GVR-unity-stk, but before removing our stuff and changing over to the new sdk's reticle, I'd love to understand what changed. Our reticle was working all the way thru 5.6b9 (without the GVR-unity-stk, with "Native" support for Cardboard). Has anyone else come across this?

@guneyozsan
Copy link

It can be better if you open a new issue for the reticle problem.

@miraleung
Copy link
Contributor

Importing the GVR Unity SDK with the native integration is indeed the expected behaviour. For the reticle, we're using a new input system in 1.30 - please refer to GVR Demo for how we do this in Cardboard and Daydream.

@bsebag
Copy link

bsebag commented Apr 15, 2017

Dear miraleung. Your explanation above is not clear. Is there a BUG on version 5.6 for the iOS build procedure when using the GVR Unity SDK or NOT ? In a positive case, what should we do to fix it?

@miraleung
Copy link
Contributor

There will not be a problem in the 1.40 release. There currently it's a bug in 1.30 but it had since been fixed in 1.40, which is coming out soon.

@mlantin
Copy link

mlantin commented Apr 17, 2017

I have not been able to get a working install on a google daydream phone with Unity 5.6f3 and the latest gvr sdk or the January one whatever version that was. I am using the Android SDK build tools v25. I just keep getting packaging errors referencing the manifest file. Resources not found. Like VrActivityTheme. So I went back to 5.6b11 and everything works fine.

All versions work well in the editor. It just fails in the build to the phone.

@blackeuler
Copy link

I still don't understand how to get this to work. Do I install the gvr sdk or is there another package along with that one to install?

@fredsa
Copy link
Member

fredsa commented Apr 22, 2017

If you download the current Unity 5.6 release (5.6.0f3) from https://store.unity.com/download you'll get native Unity VR rendering on Android. You'll need to set the build platform in your project to Android and you'll need to enable VR support in Android player build settings, as well as as add 'Daydream' and/or 'Cardboard') under the VR SDKs (which appears beneath the VR support checkbox). Build your app (*.apk) and push it to your Android device and you'll have working stereo rendering.

In order to use the Daydream controller, and to make use of any of the other Cardboard/Daydream prefabs and scripts you'll also want to install the GVR SDK (currently 1.40.0) *.unitypackage from https://github.com/googlevr/gvr-unity-sdk

In other words:

  • You get stereo VR rendering in Unity without having to use the GVR SDK
  • However, you'll need to install the GVR SDK to use the Daydream controller, take advantage of the GVR input system and so on

Footnote:
If you have an existing project which was opened with an earlier version of Unity and/or an earlier version of the GVR SDK, here are a few things you can do to make sure you're not in a bad state:

  1. Close Unity
  2. Remove all files related to any version of the GVR SDK (get rid of Assets/GoogleVR/ and the GVR SDK files sprinkled around under Assets/Plugins/...)
  3. Delete GvrIgnoreManifestMergeCheck.txt and GvrIgnoreCompatibilityCheck.txt (you may not have these, but if you do, delete both)
  4. Open Unity (5.6.0f3); at this point your project will have errors because the GVR SDK is missing, that's expected
  5. Import the latest GVR SDK (1.40.0)
  6. Fix any compile errors in your code that remain due to API changes
  7. A few of you may have at some point created a custom AndroidManifest.xml (likely in Assets/Plugins/Android/) to workaround issues in some of the early Unity 5.6 betas; If so, remove those workarounds or simply remove this AndroidManifest.xml file entirely if you no longer have a specific purpose to include it.
  8. Build your apk and push it to your Android phone/

@nomadcandy
Copy link

I got my app rendering for IOS and Android correctly for Cardboard simply using the 5.6Of3 version of Unity as stated above and turning on VR and my device choices in Player Settings. Now however, even when I make None my first choice and Cardboard my second for VR it 1 I see the stupid cardboard overlay in scene 1 where I just want a 360 view ( I turned off both on the main camera) and it renders scene 2 with both cameras what I want but defaults to Android....hmmm. This is driving me nuts. Anyone know the C# Syntax to 1. choose IOS as the device once more and 2. remove the GVR overlay off in a scene without importing the GVRSDK into Unity as it is a crasher.

Added this C# code to my button and it does turn on the 2 cameras but all these other problems now...

using System.Collections;
using UnityEngine;
using UnityEngine.VR;

public class CCardboard : MonoBehaviour
{
void Start()
{
StartCoroutine(LoadDevice("cardboard"));

}

IEnumerator LoadDevice(string newDevice)
{
	VRSettings.LoadDeviceByName(newDevice);
	yield return null;
	VRSettings.enabled = true;


}

}

@felipe-torres
Copy link

Bump. I'm having the same problem as @nomadcandy.

@nomadcandy
Copy link

I downloaded and updated both Unity and the latest GVR SDK for Unity and I am able to get the scene in 360 then load another Scene in VR with Google Cardboard but when I go back to the 360 Scene and attempt to turn the Overlay off it crashes. It seems the memory leak is still there despite the update.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.VR;

public class ShowGoggles : MonoBehaviour
{
void Start()
{
StartCoroutine(LoadDevice(""));

}

IEnumerator LoadDevice(string newDevice)
{
	VRSettings.LoadDeviceByName(newDevice);
	yield return null;
	VRSettings.enabled = false;


}

I am wondering if an if statement is worth trying here...
Or if I need to stop the video playing prior to swapping scenes.
I am a pro IOS Developer so I did go build basic VR toggle apps in IOS and Android using the native GVR SDKS but I would love to get this working in Unity moving forward.

If anyone wants to offer up the syntax for turning the videos off before loading the other scenes or the if statement syntax awesome. I can test it and let everyone know.

@Nabeelhitec
Copy link

Follow this tutorial Video for setting VR unity SDK . Hope it will help
https://youtu.be/Qn5BCG8SPN8

@fredsa
Copy link
Member

fredsa commented Nov 15, 2017

Note this is a closed issue.

The latest version of the Google VR SDK for Unity (currently 1.110.0) works with the Unity 5.6 and later. Please file a new issue if this is not working

To switch between VR and 2D modes, see:
https://github.com/googlevr/gvr-unity-sdk/wiki/Switching-between-VR-and-non-VR-at-runtime

@MahmoudYaser1
Copy link

@batchku Did you find solution to the reticle pointer ?? me too , it works like charm in the editor but not on real device ..... please help me!!
unity 5.6.4p2 , GoogleVRForUnity_1.120.0

@MahmoudYaser1
Copy link

the canvas was in front of the raycaster ...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests