Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yes, I have built for Glass directly from Unity. It works pretty well.</p> <ul> <li><p>Set the minimum SDK to API 15, set the orientation to Landscape Left, and (optionally) set the Game view size to 640 x 360.</p></li> <li><p>Unity's Input.gyro will work with the gyroscope in the device, so you can rotate the Unity camera to match for fun augmented reality effects.</p></li> <li><p>Use the AndroidInput.GetSecondaryTouch() static method to get touches on the Glass touchpad. You can easily detect individual taps on with AndroidInput.touchCountSecondary. </p></li> <li><p>Like any GDK app, you will need to create the resource files for the voice trigger. Create the folder "Assets/Plugins/Android/res/xml" and the voice trigger XML resource. Mine is:</p></li> </ul> <p>Plugins/Android/res/xml/my_voice_trigger.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;trigger command="PLAY_A_GAME"&gt; &lt;/trigger&gt; </code></pre> <p>Finally, you need to add the voice trigger to the app manifest. Copy the default AndroidManifest.xml from inside the Unity app bundle (Unity.app/Contents/PlaybackEngines/AndroidDevelopmentPlayer) to Assets/Plugins/Android and modify it to use the voice trigger XML, by putting the follow block into the activity tag:</p> <pre><code>&lt;intent-filter&gt; &lt;action android:name="com.google.android.glass.action.VOICE_TRIGGER" /&gt; &lt;/intent-filter&gt; &lt;meta-data android:name="com.google.android.glass.VoiceTrigger" android:resource="@xml/my_voice_trigger" /&gt; </code></pre> <h2>Building</h2> <p>Plug your Google Glass into a USB cable, and "File > Build and Run" works on the device. (One note of warning: a serious 3D scene will get the GPU pretty warm.) </p> <h2>Caveats</h2> <p>The KeyCode enumeration doesn't include Glass keys (i.e. the camera button) so you can't catch that in Unity without writing a subclass of UnityNativeActivity. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload