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

Commit f391c24

Browse files
committed
GVR Unity SDK v1.0.3
1 parent 5d75c2a commit f391c24

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

GoogleVR/Editor/GvrCompatibilityChecker.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
#pragma warning disable 414
1010

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

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

3636
// Path elements.
3737
private static string ASSET_PATH_PREFIX = "Assets";
@@ -45,7 +45,7 @@ public class GvrCompatibilityChecker {
4545
private static string IMPORT_REQUIRED_TITLE = "Package Import Required";
4646
private static string IMPORT_REQUIRED_MESSAGE =
4747
"Additional libraries must be imported for GVR to be compatible with " +
48-
"this version of Unity. Please upgrade to Unity 5.4 at your earliest convenience.";
48+
"this version of Unity, which does not have the GVR native integration.";
4949
private static string MANIFEST_UPDATE_WARNING_TITLE = "AndroidManifest.xml Merge Required";
5050
private static string MERGE_MANIFEST_WARNING_MESSAGE =
5151
"Please merge the existing AndroidManifest.xml with AndroidManifest-Cardboard.xml.";

GoogleVR/Scripts/Controller/Internal/ControllerProviders/AndroidNativeControllerProvider.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,25 @@ internal AndroidNativeControllerProvider(bool enableGyro, bool enableAccel) {
199199
return;
200200
}
201201

202+
// Use IntPtr instead of GetRawObject() so that Unity can shut down gracefully on
203+
// Application.Quit(). Note that GetRawObject() is not pinned by the receiver so it's not
204+
// cleaned up appropriately on shutdown, which is a known bug in Unity.
205+
IntPtr androidContextPtr = AndroidJNI.NewLocalRef(androidContext.GetRawObject());
206+
IntPtr classLoaderPtr = AndroidJNI.NewLocalRef(classLoader.GetRawObject());
207+
Debug.Log ("Creating and initializing GVR API controller object.");
208+
api = gvr_controller_create_and_init_android (IntPtr.Zero, androidContextPtr, classLoaderPtr,
209+
options, IntPtr.Zero);
210+
AndroidJNI.DeleteLocalRef(androidContextPtr);
211+
AndroidJNI.DeleteLocalRef(classLoaderPtr);
212+
if (IntPtr.Zero == api) {
213+
Debug.LogError("Error creating/initializing Daydream controller API.");
214+
error = true;
215+
errorDetails = "Failed to initialize Daydream controller API.";
216+
return;
217+
}
218+
219+
220+
202221
Debug.Log("Creating and initializing GVR API controller object.");
203222
api = gvr_controller_create_and_init_android(IntPtr.Zero, androidContext.GetRawObject(),
204223
classLoader.GetRawObject(), options, IntPtr.Zero);

GoogleVRForUnity.unitypackage

-8.34 KB
Binary file not shown.

0 commit comments

Comments
 (0)