LoginSignup
4
2

More than 3 years have passed since last update.

nreal developerページをざっと読んでみた (Quickstart編)

Last updated at Posted at 2020-07-04

nreal developerページをざっと読んでみた (Discover編)も見てね。

今回は https://developer.nreal.ai/develop/unity/android-quickstart
を読んでいきます!

Quickstart for Android (さあはじめよう)

まずサンプルシーンをNrealにビルドしてみようという感じですね。

Getting Started

Hardware Checklist (ハードウェアチェックリスト)

  • A Nreal Computing Unit (Android端末)
  • A pair of Nreal Light glasses (ARメガネ)
  • USB-C cable (NrealとPCをつなぐUSB-Cのケーブル)

Nreal Computing Unitはこれ
image.png

Software Checklist (ソフトウェアチェックリスト)

  • Unity 2018.2.X or higher with Android Build Support
  • Download NRSDKForUnity_1.2.1
    • NRSDKForUnity_1.2.1.unitypackage
  • Android SDK 8.0 (API Level 26) or later
    • installed using the SDK Manager in Android Studio

Unity,Android Studio,unitypackageを準備しましょう。バージョンを間違えないように。
(バージョンについては最新の公式ページを常に確認するようにしましょう。この記事が古くなる可能性があります)

Creating a Unity Project (プロジェクト作ろう)

  • Unityプロジェクトを新しく作る
  • Player Settings > Other Settings > Scritping Runtime Version to .net 4.x Equivalentに変更
  • NRSDKForUnity_1.2.1.unitypackageをimport

Hello MR - Your First Sample App (サンプルシーンでApp作ろう)

Assets > NRSDK > Demos > HelloMRをつくるよ。

Configure Build Settings(ビルドセッティングの設定)

  • File > Build Settingsを開く
  • Switch PlatformでAndroidに変更
  • Player Settingsを開き以下のように変更
Setting Value
Player Settings > Resolution and Presentation > Default Orientation Portrait
Player Settings > Other Settings > Auto Graphics API false
Player Settings > Other Settings > Graphics APIs OpenGLES3
Player Settings > Other Settings > Package Name オリジナルの名前にしよう 例えば, com.nreal.helloMR
Player Settings > Other Settings > Minimum API Level Android 8.0 or higher
Player Settings > Other Settings > Target API Level Android 8.0 or higher
Player Settings > Other Settings > Write Permission External(SDCard)
Player Settings > Other Settings > Allow 'unsafe' code true
Project Settings > Quality > V Sync Count Don't Sync

Connect to Nreal Device

PCとNrealをUSB-Cケーブルでつなごう。

Build and Run

Nrealへapkファイルをビルドするパターンは2種類あります。

  • UnityのBuild後、PCとNrealをケーブルとつなぎ、adb install -r {apkName}.apkを実行する
    • adbコマンドについては調べてみましょう
  • PCとNrealをケーブルでつなぎ、UnityでBuild and Runを行う

また、ケーブル経由のビルドと、Wifi経由のビルドがあります。Wifi経由のビルドの方法を書きます。

Wifi経由の接続の仕方

こちらを参考に
https://developer.android.com/studio/command-line/adb

  • PCとNrealの両方がアクセス可能なWi-Fi ネットワークに接続します。
  • PCとNrealをケーブルで接続
  • ポート 5555でTCP/IP接続をリッスンするようにターゲットデバイスを設定します。
    • adb tcpip 5555
  • PCとNrealをつないでいるケーブルを離します。
  • NrealのIPアドレスを確認します
  • 確認した IP アドレスを使用して、デバイスに接続します。
    • adb connect 192.168.xxx.yyyy:5555
  • 接続されたか確認する
    • adb devicesと打ってList of devices attached 192.168.1.50:5555 deviceと出れば成功

ビルド成功!

SucessかSucessfulみたいな文字列を観測できたら成功です!
nrealを起動して確認してみましょう。

気になったポイント

If it is the first time you run this app, you need to authrize the app by some tools like scrcpy.

最初にビルドした場合、アプリの承認が必要なようです。(私はすでに承認済みだったため必要ありませんでした)

(Optional) Use Android Logcat to view logged messages. We recommend using WiFi Android Debug Bridge (adb) to connect to your PC so that you do not have to be connected through the data cable most of the time.

Androidのログ表示機能が使えるみたいです。
https://developer.android.com/studio/command-line/logcat?hl=ja

Next Step

次回はImage Tracking編

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2