UCB PreExport method no longer working

My team has been using the PreExport method during cloud build for a while now to auto increment build numbers. This has worked really well. Recently this stopped working with no changes on our side.

Did the method format change? I had a support ticket open through the Unity site and it was responded to and then deleted. The response said something about the signature changing but when I went to open the full message it wouldn’t open. Any ideas why that would be?

For additional info, here is what we have been using:
#if UNITY_CLOUD_BUILD
public static void PreExport(UnityEngine.CloudBuild.BuildManifestObject manifest)
{
string buildNumberText = manifest.GetValue(“buildNumber”);
int buildNumber = int.Parse(buildNumberText);
Debug.LogWarning("Setting build number to " + buildNumber);
PlayerSettings.Android.bundleVersionCode = buildNumber;
PlayerSettings.iOS.buildNumber = buildNumber.ToString();
}
#endif

From what I’ve seen a lot of people use this script or one almost exactly the same. Nobody is running into this issue?

Hi, can you share with me the link to the support ticket. I can follow up with the team to see what happened there.

My ticket number is 1083873. Nothing I do will let me open that ticket now. The reply I got on the ticket that I can partially read via email is wrong though.

I am having the same issues, it works on iOS build but on android seems to have the same error

9: [Unity] ERROR: export method 'AutoIncrementVersionCodeInCloudBuild.PreExport' not found, aborting. Please make sure you are using the correct function signature.
10: [Unity] ERROR: preExportMethod 'AutoIncrementVersionCodeInCloudBuild.PreExport' failed, aborting.

Update, suddenly ios build also encountering same issues

Somebody else was having a similar problem and I posted a possible fix here ( Pre-Export Method Failure with no details ). You need to make sure your class isn’t derived from MonoBehaviour (also make sure it’s in an Editor folder).

1 Like

I’ve tried both with and without MonoBehavior and that didn’t help unfortunately.

The only other issues I’ve seen people run into are:

  1. Copy and pasting their function name accidentally puts a space character at the end in the Cloud Build config
  2. Having a custom ‘UnityEngine.CloudBuild.BuildManifestObject’ class in their project which overrides the cloud build one. Some people do this to get it compiling in their editor but forget to remove it.

You could also put a debug.log in your function and check if it’s appearing in the (full) logs. What other errors do you get from the logs?

I ended up forcing cloud build to use a fixed version of Unity and it started working again.

1 Like