Which file determines build platform?

I’m trying to find out where the chosen build platform is saved. For example, I open Unity, build platform is set to PC and Mac Standalone, I change it to iOS, quit Unity, deleted the Library folder, open Unity and the build platform is back to PC and Mac Standalone. So, is the relevant file in Library? And which file is it?

Thanks!

It’s PlayerBuildSettings.asset I think.

My guess would be Library/EditorUserBuildSettings.asset, but you can probably determine it from AssetImportState.

With a new project git control project with Forced Text asset serialization, I’m switching between ios and android. The only changed files I’m seeing are:

  • Library/AssetImportState (right away, the rest are saved with the project)
  • Library/assetDatabase3 (binary)
  • Library/EditorUserBuildSettings.asset (binary)
  • Library/metadata//<32 digit hex> (sometimes multiple)

For me, it looks like AssetImportState has the ascii value “13;589824;2304;-1” for ios and “9;16842754;65792;-1” for android. Which seems different enough for a check, but it gets reverted upon reload.

EditorUserBuildSettings.asset is a binary file and appears to be the authority of which platform the project is pointing to.

FYI, this is using Unity 5.4.4p2 which doesn’t exist in 2012. Hope this helps anyway.

All project settings are usually stored in the project database which is represented by the library folder. It’s probably a binary field in one of the database files. You really shouldn’t change it manually. Unity has to do a lot conversions when you switch the build platform. Maybe write an editor script which switches the platform?

Library/PlayerDataCache/ScriptLayoutHashes.txt is work for me.

You can get the platform string by the following example:

➜  cat ContinuousBuildStandaloneWindows64/Library/PlayerDataCache/ScriptLayoutHashes.txt | head -n1
WindowsStandalone
➜  cat ContinuousBuildStandaloneOSX/Library/PlayerDataCache/ScriptLayoutHashes.txt | head -n1
OSXStandalone
➜  cat ContinuousBuildIOS/Library/PlayerDataCache/ScriptLayoutHashes.txt | head -n1
iOS
➜  cat ContinuousBuildAndroid/Library/PlayerDataCache/ScriptLayoutHashes.txt | head -n1
Android

The answer of @kyle-misner-kriel and jepnvr worked for me in Unity 2021.3.9f1.
It is indeed the file Library/EditorUserBuildSettings.asset

To include it, I had to do the following in the gitignore file:

  1. remove following line: [Ll]ibrary/
  2. Add following lines (without the enumeration naturally):
  3. /[Ll]ibrary/*
  4. !/[Ll]ibrary/

As for why, this SO post is quite good to explain it: git - .gitignore exclude folder but include specific subfolder - Stack Overflow