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

GVR Keyboard Doesn't Work With IL2CPP #917

@Moncader

Description

@Moncader

Summary:
When enabling IL2CPP in the newest versions of Unity with the new .NET system, if you attempt to show the GVR Keyboard, Unity will crash.

Found using:

  • Google VR SDK version: v1.130.1
  • Unity version: 2018.1.0f2
  • Phone manufacturer, model, and O/S version: All Pixel/Pixel 2 devices
  • Viewer manufacturer & model: Daydream View (both)

Steps to reproduce the issue:

  1. Show the GVR Keyboard

Workarounds:

--- a/Assets/GoogleVR/Scripts/Keyboard/GvrKeyboard.cs
+++ b/Assets/GoogleVR/Scripts/Keyboard/GvrKeyboard.cs
@@ -313,6 +315,9 @@ public class GvrKeyboard : MonoBehaviour {
     }
   }

+  private delegate void KeyboardCallbackDelegate(IntPtr closure, GvrKeyboardEvent keyboardEvent);
+
+  [AOT.MonoPInvokeCallback(typeof(KeyboardCallbackDelegate))]
   private static void OnKeyboardCallback(IntPtr closure, GvrKeyboardEvent keyboardEvent) {
     lock (callbacksLock) {
       threadSafeCallbacks.Add(keyboardEvent);

The above code fixes the issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions