###前提・実現したいこと
UnityでMyoという筋電センサアームバンドを動かしたく、https://www.gaprot.jp/pickup/unity-mecanim/unity-chan4
こちらのサイトを参考にして進めていたのですが、
MyoのUnityプラグインの入ったSDKをダウンロードして、
サンプルプログラムを動かそうとした際に以下のエラーメッセージが発生しました。
Unityの知識があまりなく、困惑しております。
よろしくお願いします。
###発生している問題・エラーメッセージ
Assets/Myo Samples/Scripts/ColorBoxByPose.cs(57,26): error CS1061: Type `UnityEngine.Component' does not contain a definition for `material' and no extension method `material' of type `UnityEngine.Component' could be found. Are you missing an assembly reference?
Assets/Myo Samples/Scripts/ColorBoxByPose.cs(53,26): error CS1061: Type `UnityEngine.Component' does not contain a definition for `material' and no extension method `material' of type `UnityEngine.Component' could be found. Are you missing an assembly reference?
Assets/Myo Samples/Scripts/ColorBoxByPose.cs(49,26): error CS1061: Type `UnityEngine.Component' does not contain a definition for `material' and no extension method `material' of type `UnityEngine.Component' could be found. Are you missing an assembly reference?
###該当のソースコード(ColorBoxByPose.cs)
C#
1using UnityEngine; 2using System.Collections; 3 4using LockingPolicy = Thalmic.Myo.LockingPolicy; 5using Pose = Thalmic.Myo.Pose; 6using UnlockType = Thalmic.Myo.UnlockType; 7using VibrationType = Thalmic.Myo.VibrationType; 8 9// Change the material when certain poses are made with the Myo armband. 10// Vibrate the Myo armband when a fist pose is made. 11public class ColorBoxByPose : MonoBehaviour 12{ 13 // Myo game object to connect with. 14 // This object must have a ThalmicMyo script attached. 15 public GameObject myo = null; 16 17 // Materials to change to when poses are made. 18 public Material waveInMaterial; 19 public Material waveOutMaterial; 20 public Material doubleTapMaterial; 21 22 // The pose from the last update. This is used to determine if the pose has changed 23 // so that actions are only performed upon making them rather than every frame during 24 // which they are active. 25 private Pose _lastPose = Pose.Unknown; 26 27 // Update is called once per frame. 28 void Update () 29 { 30 // Access the ThalmicMyo component attached to the Myo game object. 31 ThalmicMyo thalmicMyo = myo.GetComponent<ThalmicMyo> (); 32 33 // Check if the pose has changed since last update. 34 // The ThalmicMyo component of a Myo game object has a pose property that is set to the 35 // currently detected pose (e.g. Pose.Fist for the user making a fist). If no pose is currently 36 // detected, pose will be set to Pose.Rest. If pose detection is unavailable, e.g. because Myo 37 // is not on a user's arm, pose will be set to Pose.Unknown. 38 if (thalmicMyo.pose != _lastPose) { 39 _lastPose = thalmicMyo.pose; 40 41 // Vibrate the Myo armband when a fist is made. 42 if (thalmicMyo.pose == Pose.Fist) { 43 thalmicMyo.Vibrate (VibrationType.Medium); 44 45 ExtendUnlockAndNotifyUserAction (thalmicMyo); 46 47 // Change material when wave in, wave out or double tap poses are made. 48 } else if (thalmicMyo.pose == Pose.WaveIn) { 49 renderer.material = waveInMaterial; 50 51 ExtendUnlockAndNotifyUserAction (thalmicMyo); 52 } else if (thalmicMyo.pose == Pose.WaveOut) { 53 renderer.material = waveOutMaterial; 54 55 ExtendUnlockAndNotifyUserAction (thalmicMyo); 56 } else if (thalmicMyo.pose == Pose.DoubleTap) { 57 renderer.material = doubleTapMaterial; 58 59 ExtendUnlockAndNotifyUserAction (thalmicMyo); 60 } 61 } 62 } 63 64 // Extend the unlock if ThalmcHub's locking policy is standard, and notifies the given myo that a user action was 65 // recognized. 66 void ExtendUnlockAndNotifyUserAction (ThalmicMyo myo) 67 { 68 ThalmicHub hub = ThalmicHub.instance; 69 70 if (hub.lockingPolicy == LockingPolicy.Standard) { 71 myo.Unlock (UnlockType.Timed); 72 } 73 74 myo.NotifyUserAction (); 75 } 76} 77
###補足情報(言語/FW/ツール等のバージョンなど)
C#
Windows8
Unity 5.5.3
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/12/11 08:31