Unity Editorからのデバッグ時のみ実行するifdef

UNITY_EDITORを使うと、Unity Editorでのデバッグ時のみ実行するコードを書けるようです。

使い方は次のような感じです。

#if UNITY_EDITOR
Debug.log("debug");
#endif

他、UNITY_ANDROIDUNITY_IPHONE等も便利そうです。

リンク

Unity – Platform Dependent Compilation
https://docs.unity3d.com/351/Documentation/Manual/PlatformDependentCompilation.html

iTween

Unityを使っている人であれば、1度は聞いたことがあるかもしれない有名なアセット「iTween」です。

個人的によく使っているのはValueTo

Hashtable ht = new Hashtable();
ht.Add("from", 0.0f);
ht.Add("to", 1.0f);
ht.Add("time", 1.0f);
ht.Add("onupdate","myUpdateFunction");
ht.Add("oncomplete","myCompleteFunction");
iTween.ValueTo(gameObject, ht);
void myUpdateFunction(float value)
{
  Debug.Log("value = " + value);
}

void myCompleteFunction()
{
  Debug.log("Complete");
}

こんな感じで使っています。

リンク

iTween for Unity by Bob Berkebile (pixelplacement)
http://www.pixelplacement.com/itween/gettingstarted.php