- Home /
 
               Question by 
               cowlinator · Sep 29, 2014 at 09:24 PM · 
                versionpreprocessor  
              
 
              Simpler Engine Version Dependent Compilation?
I'm looking at the platform-specific compilation options that unity gives us, and at the other questions here, and it seems really limited. I mean, if I want to write a plugin with a 4.5.0 features, do I really have to write
 #if !UNITY_2_6 && !UNITY_3_0 && !UNITY_3_1 && !UNITY_3_2 && !UNITY_3_3 && !UNITY_3_4 
      && !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_1 && !UNITY_4_2 && !UNITY_4_3 && !UNITY_4_4
 //code with unity 4.5.0 feature
 #else
 //alternative code
 #endif
in every single file? And the problem is only going to get worse as more versions are released.
Surely there must be a better way!
               Comment
              
 
               
              Answer by Kiwasi · Sep 29, 2014 at 09:29 PM
You could do
 #if Unity_4_5
 // Platform code
 #else
 // Alternative code
 #endif
This will still break every time the version increases. Not sure there is a way around that.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                