Search Unity

UnityEngine.CloudBuild compile error

Discussion in 'Unity Build Automation' started by Mycroft, Jan 20, 2016.

  1. Mycroft

    Mycroft

    Joined:
    Aug 29, 2012
    Posts:
    160
    "UnityEngine.CloudBuild." throws an error when being used in my project. The following code will not compile.

    I end up surrounding the function in "#if UNITY_CLOUD_BUILD" which allows it to compile and does work inside CloudBuild.

    It makes it very difficult to know what code will work though.

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. public class CloudBuildPreExport : MonoBehaviour {
    5.  
    6.     public static void PreExport(UnityEngine.CloudBuild.BuildManifestObject manifest)
    7.     {
    8.         PlayerSettings.bundleVersion = string.Format("{0}.{1}", PlayerSettings.bundleVersion, manifest.GetValue("buildNumber", "unknown") );
    9. }
    10. }
     
    masterton likes this.
  2. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    785
    Ya unfortunately that's where we are at right now. One thing you could do to make local development easier is to create a local version of the UnityEngine.CloudBuild.BuildManifestObject - just don't check it into your repo (add it to .gitignore, etc.). See the Build Manifest Guide on the 'BuildManifestObject' tab we provide the full public interface for the class (which you can just provide empty/placeholder implementations locally for testing).

    Longer term we want to allow you to build locally exactly how it will build on Cloud Build, but that is a ways off.
     
    GarthSmith and Mycroft like this.
  3. Mycroft

    Mycroft

    Joined:
    Aug 29, 2012
    Posts:
    160
    Ok, I had seen that suggestion on the BuildManifestObject page but didn't make the connection with this particular problem. I'll look into that.

    Absolutely, the interface and configurations are powerful. I've moved my personal project, and team projects, to CloudBuild because of time saved, fewer errors, and the ability to create very specific target builds. It's a serious improvement.
     
  4. jknight-nc

    jknight-nc

    Joined:
    Jun 10, 2014
    Posts:
    52

    Why is it not simple to have the UnityEngine.CloudBuild namespace be populated locally? It's over a year later! The cloud build is great and these export methods are great, but it's tough to write bug-free code like this.
     
  5. Victor-Garcia

    Victor-Garcia

    Joined:
    Jul 16, 2014
    Posts:
    3
    Hi everybody,

    Is there currently any problem with the preExportMethod?. I am using the same config I used a year ago in a different project, and I always get the error: "preExportMethod 'App.Build.CloudBuild.PreBuild' failed, aborting".
    As far as I know, the preExportMethod has an optional BuildManifestObject parameter. Therefore, the next code should work.
    Code (CSharp):
    1. namespace App.Build
    2. {
    3.     public sealed class CloudBuild
    4.     {
    5.         public static void PreBuild ( )
    6.         {
    7.             #if UNITY_IOS
    8.             FileUtil.DeleteFileOrDirectory("Assets/GooglePlayGames");
    9.             FileUtil.DeleteFileOrDirectory("Assets/GooglePlayGames");
    10.             FileUtil.DeleteFileOrDirectory("Assets/PlayServicesResolver");
    11.             FileUtil.DeleteFileOrDirectory("Assets/Plugins");
    12.             AssetDatabase.Refresh();
    13.             #endif
    14.         }
    15.     }
    16. }
    My config of preExportMethod in the project is App.Build.CloudBuild.PreBuild

    I tried, @Mycroft suggestion using the BuildManifestObject parameter and #if UNITY_CLOUD_BUILD, but nothing got better.

    Anyone has any clue about what is the problem? Thanks in advance
     
  6. Rabadash8820

    Rabadash8820

    Joined:
    Aug 20, 2015
    Posts:
    94
    @dannyd Sorry to necro an old thread, but has there been any progress here? I would really love to see a Unity Package or NuGet package that could be referenced so that we can code against the Unity.CloudBuild APIs without needing ugly precompiler directives. Thanks.
     
    dtaddis likes this.
  7. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    1,163
    It's been 4 years now and this still not fix?

    At least please put #define CLOUD_BUILD on that class and let us access it inside #if
     
    Meatloaf4 likes this.
  8. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    xucian and Thaina like this.
  9. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
  10. AdamBebko

    AdamBebko

    Joined:
    Apr 8, 2016
    Posts:
    168
  11. rajivrao

    rajivrao

    Unity Technologies

    Joined:
    Feb 19, 2019
    Posts:
    111
    Thanks for raising. We've flagged this for our documentation team and should be able to update first thing in the new year -- appreciate your patience!
     
  12. Rabadash8820

    Rabadash8820

    Joined:
    Aug 20, 2015
    Posts:
    94