これはInput.locationを使って位置情報を調べるテストコードですが、Inputがどうやら使えないようで、Inputを使うための何か別のライブラリが必要なのでしょうか?
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Net; using System.Net.Sockets; using System.Text; using System.Threading; //ここだけでは使わないものもimportしています public class Test { public void GetGPS() { // 設定でロケーション機能を有効にしているかどうか調べる if (!Input.location.isEnabledByUser){ break; } // 位置情報取得 Input.location.Start(); //ステータスが Initializing状態の間ループ while (Input.location.status == LocationServiceStatus.Initializing) { //タイムアウト処理 break; } // ユーザがアクセス拒否した状態の処理 if (Input.location.status == LocationServiceStatus.Failed) { Console.Write("ロケーション機能が有効ではありません"); break; }else{ st = Input.location.lastData(); // アクセス成功表示 Console.Write("Location: "+Input.location.lastData.latitude+" "+Input.location.lastData.longitude+" "+Input.location.lastData.altitude+" "+Input.location.lastData.horizontalAccuracy+" "+Input.location.lastData.timestamp); int[] gpsdata; gpsdata = new int[]{Input.location.lastData.latitude,Input.location.lastData.longitude,Input.location.lastData.altitude,Input.location.lastData.horizontalAccuracy,Input.location.lastData.timestamp}; //GPS取得ストップ Input.location.Stop(); } return gpsdata; } }
---環境
unityではなくターミナルで「mcs スクリプトファイル.cs」でコンパイルしています。
---エラー内容
error CS0103: The name `Input' does not exist in the current context
error CS0139: No enclosing loop out of which to break or continue
error CS0103: The name `Input' does not exist in the current context
error CS0103: The name `Input' does not exist in the current context
error CS0103: The name `Input' does not exist in the current context
error CS0139: No enclosing loop out of which to break or continue
error CS0103: The name `Input' does not exist in the current context
error CS0103: The name `st' does not exist in the current context
error CS0103: The name `Input' does not exist in the current context
error CS0103: The name `Input' does not exist in the current context
error CS0103: The name `Input' does not exist in the current context
error CS0103: The name `Input' does not exist in the current context
error CS0103: The name `Input' does not exist in the current context
error CS0103: The name `Input' does not exist in the current context
error CS0103: The name `Input' does not exist in the current context
error CS0103: The name `gpsdata' does not exist in the current context
*if(!Input.location.isEnabledByUser)の行が最初のエラー箇所です。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/02/27 13:46