- Home /
Pass Jenkins Environment Variables to Unity3dBuilder
Hi,
I am using Jenkins with the Unity3dBuilder plugin, and I would like to pass the current build number to Unity as a command line argument. I know Jenkins has a built in environment variable for this (BUILD_NUMBER), I am just wondering how to pass it to Unity.
Right now my command line parameters look like this:
-quit -batchMode -executeMethod Build.BuildAndroid -buildNumber %BUILD_NUMBER%
However, when I trace the debug output I don't get the Jenkins build number, I just get a string containing "%BUILD_NUMBER%". Anyone have an idea how I can do this?
Thanks!
Answer by wiiarethesound · Mar 14, 2015 at 06:32 PM
I managed to figure this one out on my own :) The command line parameters had to look like this:
-quit -batchMode -executeMethod Build.BuildAndroid -buildNumber "$BUILD_NUMBER"
Answer by yoyo · Jul 29, 2015 at 11:22 PM
Since you launch Unity.exe from the Jenkins environment the Unity process will inherit all the environment variables, so you can use System.Environment.GetEnvironmentVariable to read any variable you like.