I understand that this folder can be useful, so I’m not asking to remove it entirely
But can we have an option to disable it? Or at least don’t put it in the build folder?
I have an automated build pipeline and it’s very annoying to have it as I obviously dont want it included in my release builds
I tried making a script to delete the folder before uploading, but sometimes I get exceptions thrown of a sharing violation (unity still holding locks on the file?)
It’s been such a pain that I’ve decided to stop using IL2CPP and go back to mono for now
Any thoughts on my proposal, or advice on how to deal with it for the mean time?
The goal of it was to be annoying enough that you’d notice and add a custom action to back it up in your release pipeline. Looks like that plan failed :(. Thing is, if you delete it and now your game crashes in the wild, the crash dumps will be utterly useless. And you can’t recreate these files after they’ve been deleted.
Unity should not be holding any locks on it. Are you sure it’s Unity who has it locked? Would love a bug report if this is reproducible.
How do I prevent those folders from generating with every build?
It increases build time dramatically.
I simply don’t need them.
It didn’t exist in v2020 nor in 2021.3 is annoying
I made a helper script for this which does the following once a build has ran:
If building for IOS, removes the Xcode build target platform ‘My Mac’ which would otherwise try to automatically run your IOS app on your Mac when using Build & Run from Unity on Xcode build target
If using the Burst package, the Burst Debug folder will be deleted on a successful build
If building for il2cpp, the il2cpp Debug folder will be deleted on a successful build
using System;
using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
using UnityEngine;
using UnityEngine.Assertions;
public class CleanupPostProcessorBuild
{
[PostProcessBuild(2000)]
public static void OnPostProcessBuild(BuildTarget target, string path)
{
#if UNITY_IOS
Debug.Log("iOSBuildPostProcess is now postprocessing iOS Project");
var projectPath = PBXProject.GetPBXProjectPath(path);
var project = new PBXProject();
project.ReadFromFile(projectPath);
var targetGuid = project.GetUnityMainTargetGuid();
project.SetBuildProperty(targetGuid, "SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD", "NO");
try
{
var projectInString = File.ReadAllText(projectPath);
projectInString = projectInString.Replace("SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;",
$"SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;");
File.WriteAllText(projectPath, projectInString);
}
catch (Exception e)
{
Debug.LogException(e);
}
project.WriteToFile(projectPath);
#endif
string outputPath = path;
try
{
string applicationName = Path.GetFileNameWithoutExtension(outputPath);
string outputFolder = Path.GetDirectoryName(outputPath);
Assert.IsNotNull(outputFolder);
outputFolder = Path.GetFullPath(outputFolder);
//Delete Burst Debug Folder
string burstDebugInformationDirectoryPath = Path.Combine(outputFolder, $"{applicationName}_BurstDebugInformation_DoNotShip");
if (Directory.Exists(burstDebugInformationDirectoryPath))
{
Debug.Log($" > Deleting Burst debug information folder at path '{burstDebugInformationDirectoryPath}'...");
Directory.Delete(burstDebugInformationDirectoryPath, true);
}
//Delete il2cpp Debug Folder
string il2cppDebugInformationDirectoryPath = Path.Combine(outputFolder, $"{applicationName}_BackUpThisFolder_ButDontShipItWithYourGame");
if (Directory.Exists(il2cppDebugInformationDirectoryPath))
{
Debug.Log($" > Deleting Burst debug information folder at path '{il2cppDebugInformationDirectoryPath}'...");
Directory.Delete(il2cppDebugInformationDirectoryPath, true);
}
}
catch (Exception e)
{
Debug.LogWarning($"An unexpected exception occurred while performing build cleanup: {e}");
}
}
}