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

Commit

Permalink
GVR Unity SDK v1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
cyisrael committed Nov 9, 2016
1 parent 5d75c2a commit f391c24
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
10 changes: 5 additions & 5 deletions GoogleVR/Editor/GvrCompatibilityChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#pragma warning disable 414

/// <summary>
/// Updates Unity 5.2 and 5.3 with additional GVR library imports if those files do not exist.
/// Otherwise, if this is Unity 5.4 and there are legacy libraries or AndroidManifest.xml,
/// they are removed.
/// Updates non-native versions of Unity with additional GVR library imports if those files
/// do not exist. Otherwise, if this is Unity 5.4 and there are legacy libraries or
/// AndroidManifest.xml, they are removed.
/// </summary>
[InitializeOnLoad]
public class GvrCompatibilityChecker {
Expand All @@ -31,7 +31,7 @@ public class GvrCompatibilityChecker {

// GVR backwards-compatible package.
private static string BACK_COMPAT_PACKAGE_PATH =
"/GoogleVR/gvr-5.2-and-5.3-compatible.unitypackage";
"/GoogleVR/compatibility-without-gvr-integration.unitypackage";

// Path elements.
private static string ASSET_PATH_PREFIX = "Assets";
Expand All @@ -45,7 +45,7 @@ public class GvrCompatibilityChecker {
private static string IMPORT_REQUIRED_TITLE = "Package Import Required";
private static string IMPORT_REQUIRED_MESSAGE =
"Additional libraries must be imported for GVR to be compatible with " +
"this version of Unity. Please upgrade to Unity 5.4 at your earliest convenience.";
"this version of Unity, which does not have the GVR native integration.";
private static string MANIFEST_UPDATE_WARNING_TITLE = "AndroidManifest.xml Merge Required";
private static string MERGE_MANIFEST_WARNING_MESSAGE =
"Please merge the existing AndroidManifest.xml with AndroidManifest-Cardboard.xml.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,25 @@ internal AndroidNativeControllerProvider(bool enableGyro, bool enableAccel) {
return;
}

// Use IntPtr instead of GetRawObject() so that Unity can shut down gracefully on
// Application.Quit(). Note that GetRawObject() is not pinned by the receiver so it's not
// cleaned up appropriately on shutdown, which is a known bug in Unity.
IntPtr androidContextPtr = AndroidJNI.NewLocalRef(androidContext.GetRawObject());
IntPtr classLoaderPtr = AndroidJNI.NewLocalRef(classLoader.GetRawObject());
Debug.Log ("Creating and initializing GVR API controller object.");
api = gvr_controller_create_and_init_android (IntPtr.Zero, androidContextPtr, classLoaderPtr,
options, IntPtr.Zero);
AndroidJNI.DeleteLocalRef(androidContextPtr);
AndroidJNI.DeleteLocalRef(classLoaderPtr);
if (IntPtr.Zero == api) {
Debug.LogError("Error creating/initializing Daydream controller API.");
error = true;
errorDetails = "Failed to initialize Daydream controller API.";
return;
}



Debug.Log("Creating and initializing GVR API controller object.");
api = gvr_controller_create_and_init_android(IntPtr.Zero, androidContext.GetRawObject(),
classLoader.GetRawObject(), options, IntPtr.Zero);
Expand Down
Binary file modified GoogleVRForUnity.unitypackage
Binary file not shown.

0 comments on commit f391c24

Please sign in to comment.