UNITY_EDITOR
を使うと、Unity Editorでのデバッグ時のみ実行するコードを書けるようです。
使い方は次のような感じです。
#if UNITY_EDITOR
Debug.log("debug");
#endif
他、UNITY_ANDROID
やUNITY_IPHONE
等も便利そうです。
リンク
Unity – Platform Dependent Compilation
https://docs.unity3d.com/351/Documentation/Manual/PlatformDependentCompilation.html