0
\$\begingroup\$

I am trying to export an Xcode project targeting macOS via the Unity3D command line in Continuous Integration.

However, I cannot figure out the right build setting to export an XCode project for macOS through the command line. The Android build target has a specific setting in EditorUserBuildSettings to export an Android Studio project, but I am unable to figure out how to do this for macOS.

Has anyone done this before and can help me out?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

I managed to figure it out based on a thread in the Unity forums.

Some of the build settings are stored in Library/EditorUserBuildSettings.asset as a binary file (ignores the project settings for asset serialization as text).

The EditorUserBuildSettings has a SetPlatformSettings methods which allows you to change arbitrary properties in the build settings. Reverse engineering the editor build settings asset file and using this method allowed me to change this using the command line.

var createXCodeProject = EditorUserBuildSettings.GetPlatformSettings("OSXUniversal", "CreateXcodeProject");
Console.WriteLine($"[EditorUserBuildSettings] Create XCode project: {createXCodeProject}");
                    
if (buildPath.EndsWith(".app"))
{
     EditorUserBuildSettings.SetPlatformSettings("OSXUniversal", "CreateXcodeProject", "false");
}
else
{
     EditorUserBuildSettings.SetPlatformSettings("OSXUniversal", "CreateXcodeProject", "true");
}
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .