御世話になります
###前提・実現したいこと
unityでandroidマシンの解像度の取得するために、http://neareal.com/2472/という記事を参考にしました。
###発生している問題・エラーメッセージ
APKをビルドしたところ、解像度を取得する段で
Assets/game.cs(11,30): error CS0103: The name `UnityEditor' does not exist in the current context Error building Player because scripts had compiler errors UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors. at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162 at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83 UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
というエラーがでました。
###該当のソースコード
void Start () { string[] screenres = UnityEditor.UnityStats.screenRes.Split('x'); int width = int.Parse(screenres[0]); int height= int.Parse(screenres[1]); }
###試したこと
ソースファイルの冒頭に、
using UnityEditor;
と記述しましたが、UnityEditorが存在しないという主張に変わりがありません。
###補足情報(言語/FW/ツール等のバージョンなど)
Unity 2017,1,1f Personal (64bit)
言語はC#
どうすれば、スマホの解像度が取得できますか。
宜しくお願い致します。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/11/27 12:41