LoginSignup
2
2

More than 5 years have passed since last update.

Debug.isDebugBuildとDevelopment BuildとCloud Build

Posted at

Debugクラスには、isDebugBuildというプロパティがあります。

これは、「デバック時だけパラメータをいじることができるビューを表示する」など、デバックの際に活用することができます。

リファレンス

次のコードは、Debug.isDebugBuildtrueの時だけ、GUIのボタンを表示する例です。

using UnityEngine;

public class DebugView : MonoBehaviour
{
    void OnGUI()
    {
        if (!Debug.isDebugBuild)
        {
            return;
        }

        var width = Screen.width / 4;
        var height = Screen.height / 16;

        if (GUI.Button(new Rect(10, 10, width, height), "Show Debug View"))
        {
            ShowDebugView();
        }
    }

    /* 略 */
}

Debug.isDebugBuildは、Unity Editorで設定する場合は、File > Build Settingsの中から、Development Buildをチェックするとtrueに、チェックを外すとfalseになります。

Cloud Buildでは、設定タブを選択 > 高度設定を表示 > 高度な設定を変更 > 開発用ビルドのチェックボックスを編集することで、Debug.isDebugBuildを設定できます。

Unity Editorでも、Cloud Buildでも、Debug.isDebugBuildを活用して、デバックを円滑に行いたいですね。

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