Build pipeline: Build size is different depending on the way of building

I’ve got a strange issue with a build pipeline process when I’m building a project for iOS. I’m using a build pipeline to automize my building process. So the problem is when I’m building the project using BuildPipeline.BuildPlayer(buildPlayerOptions) my build size is larger than when I’m building it manually. The difference is about 100 MB after compiling in Xcode. So I noticed a strange moment: when I build manually, in the build folder with the path “buildfolder/Data/”, the file called “data.unity3d” is smaller and takes 50 MB less than when it’s built by the function BuildPipeline.BuildPlayer in my script. By the way, in BuildPlayerOptions.options, I set the value BuildOptions.CompressWithLz4HC It looks like this option doesn’t work when I’m building by this method. How to fix that?

My Unity version is 2020.3.25f1.

Fixed

Please share your fix. Google searches for the problem might now lead here, only to be told there is a fix, but not what the fix is. Imagine how frustrating that would have been for you.

1 Like

The problem was with changing textures compression. BuildOptions.CompressWithLz4HC didn’t change. When I switched platforms, the texture compression was the LZ4 or Default. I configured the texture compression manually at the build settings, and it was fixed.

1 Like