Unityのビルドでは様々なエラーが出ます。
「The type or namespace name 'EditorApplication' does not exist」エラーの場合の対処です。
「The type or namespace name 'EditorApplication' does not exist」エラーの場合は?
ビルドで以下のようなエラーとなりました。
Assets\scrTimer.cs(44,12): error CS0234: The type or namespace name 'EditorApplication' does not exist in the namespace 'UnityEditor'
(are you missing an assembly reference?)
「EditorApplication」のネームスペースが存在しないというものです。
エラー場所やネット情報をみると、まずソースでエラーが起きていたのは
UnityEditor.EditorApplication.isPaused = true;
という場所です。
これはエラーの場合にシーンの再生を止めるものです。
組み込んだ理由としては、エラーがたくさん出る場合にエラーが出たラすぐ再生を止めたいためです。
アプリケーションをビルドすると、エディターで停止というのはそもそも不要となります。
この場合の対応としては
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPaused = true;
#endif
のようにユニティのエディタ上でのみスクリプトを有効とすればOKでした。
c# - The type or namespace name `UnityEditor' could not be found - Stack Overflow
本ブログのUnity関連記事一覧はこちら。