Unityな日々(Unity Geek)

Unityで可視化アプリを開発するための試行錯誤の覚書

Unityのバージョンで処理を変える

Unity Script Reference – Overview: Script compilation (Advanced)
特定のバージョンに対してのみ処理を行うことができる。例えば、Ver. p.q.r だけの処理は、
#if Use Unity_p_q_r
<バージョン特有の処理>
#endif
とする。

p.q.x(xは任意)と、マイナーバージョンは関係なく適用する場合は、
#if Use Unity_x_y
とする。

// Specific version define including the minor revision
#if UNITY_2_6_0
// Use Unity 2.6.0 specific feature
#endif

// Specific version define not including the minor revision
#if UNITY_2_6
// Use Unity 2.6.x specific feature
#endif