Starting from Unity 5.3.4, you can compile code selectively based on the earliest version of Unity required to compile or execute a given portion of code. Given the same version format as above (X.Y.Z), Unity exposes one global define in the format UNITY_X_Y_OR_NEWER, that can be used for this purpose.
The supported defines are: