Unity has a concept of Platform Dependent Compilation.
In your C# code you can check the particular version.
#if UNITY_5 // do this #else // print unsupported #endif
When generating project files, Unity will inject Define Constants into the C# project.
I’m asking if UE4 has something similar so that I can have custom version code in the Plugins\MyPlugin\Source\MyPlugin.Build.cs C# script.
There’s a slightly different API for Unity 4.9, 4.11, and 4.12 with the build script and it would be great to support multiple versions so that users don’t have to modify the plugin build script or see any compilation errors.
When generating the unreal project files the Build script is added to the C++ project as an include/no compile option.
Intermediate/ProjectFiles/ExampleProject.vcxproj: <None Include="..\..\Plugins\MyPlugin\Source\MyPlugin\MyPlugin.Build.cs" />
Any symbols that are added are compiled into the UE4 Editor.
Ideally a tool would read the build version here:
And generate C# build symbols for UE4_12.
The build version could be checked at runtime.
And through reflection, the build version could be used to invoke the intended API.
However, I intend to check the build version at compile time.
Your feedback is appreciated.