2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

The Eye TribeのC# SDKをUnityで使用する準備

Posted at

はじめに

本稿では、The Eye Tribeという眼球の動きをトラッキングするセンサをUnityで使用するための、環境構築の手順を紹介します。これとかこれとか、The Eye TribeとUnityを連携した面白いサンプルが公式で用意されています。
Unityそのものの使い方については触れません。

1. Unityプロジェクトを作成する

The Eye TribeのSDKを使用するUnityプロジェクトを作成します。

2. dllをダウンロードする

C# SDKのGitHubリポジトリのreleasesから、最新のTETCSharpClient.dllとNewtonsoft.Json.dllをダウンロードします。

スクリーンショット 2016-03-10 20.40.57.png

3. dllをUnityプロジェクトのAssets以下に配置する

ダウンロードした2つのdllを、作成したUnityプロジェクトのAssets以下の任意のディレクトリに配置します。
私は[Unityプロジェクトのルートディレクトリ]/Assets/Pluginsに配置しています。

4. API Comparability Levelを .NET 2.0 に設定する

Unityにて、File -> Build Settings -> Player Settings -> Other Settingsから、API Comparability Levelを .NET 2.0 に設定します。

スクリーンショット 2016-03-10 20.47.33.png

おそらくここがデフォルトで .NET 2.0 Subset となっていますが、このままUnityプロジェクトをビルドしようとするとNewtonsoft.Json.dllが読み込めず、以下のようにReflectionTypeLoadExceptionという例外が投げられます。ここで私はしばらくハマりました。

Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in :0
at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in :0
at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in :0
at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in :0
at Mono.CSharp.Driver.LoadReferences () [0x00000] in :0
at Mono.CSharp.Driver.Compile () [0x00000] in :0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0

The class System.ComponentModel.INotifyPropertyChanging could not be loaded, used in System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
The class System.ComponentModel.AddingNewEventHandler could not be loaded, used in System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
The class JTokenReferenceEqualityComparer could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JContainer could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JObject could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JContainer could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JContainer could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JContainer could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class JPropertyList could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JObject could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JArray could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JObject could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JObject could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JProperty could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class d__42 could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class <Convert>d__f2 could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class d__0 could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class d__2 could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class d__0 could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class <>c__DisplayClass2 could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed

5. 準備完了!

環境構築は以上です。これでC#のスクリプトを書くときにThe Eye TribeのC# SDKを使用することができます。
SDKを使用したコーディングは以下が参考になると思います。

関連リンク

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?