Search Unity

Setting 'Scene List' from script

Discussion in 'Unity Build Automation' started by arnebp, Jun 20, 2016.

  1. arnebp

    arnebp

    Joined:
    Oct 15, 2013
    Posts:
    22
    Hi

    I have been trying to figure out if it is possible to set the UCB 'Scene List' from a 'Pre-Export Method' script. I am trying to avoid too many configuration dependencies in the UCB web interface per project.

    I've tried the below (and a few other approaches) with no success. Anybody know if this is even possible?

    Code (CSharp):
    1.    
    2. private string[] levels = new string[] { "Assets/Scenes/a.unity", "Assets/Scenes/b.unity" };
    3.  
    4. public static void PreExportWin64(UnityEngine.CloudBuild.BuildManifestObject manifest)
    5. {
    6.   _Manifest = manifest;
    7.  
    8.   PlayerSettings.bundleVersion = String.Format("1.0.{0}",
    9.     _Manifest.GetValue("buildNumber", "0"));
    10.  
    11.   // We enable desired scenes
    12.   EditorBuildSettingsScene ebss;
    13.   for(int i = EditorBuildSettings.scenes.Length; --i>=0; )
    14.   {
    15.     ebss = EditorBuildSettings.scenes[i];
    16.     ebss.enabled = false;
    17.  
    18.     for(int j = levels.Length; --j>=0; )
    19.     {
    20.       if(levels[j].CompareTo(ebss.path) == 0)
    21.       {
    22.         ebss.enabled = true;
    23.         break;
    24.       }
    25.     }
    26.   }
    27. }
    28.  
     
  2. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    785
    Do you have scenes configured in the advanced settings for that build target on the Cloud Build dashboard? If so, it will always use those over what ends up in the EditorBuildSettings.
     
  3. arnebp

    arnebp

    Joined:
    Oct 15, 2013
    Posts:
    22
    Scene list under advanced is empty, yet the editor settings from version control is used and the efforts of the preexport method have no effect. Please look into this.
     
  4. arnebp

    arnebp

    Joined:
    Oct 15, 2013
    Posts:
    22
    Have you had time to look into this @dannyd ? If not currently supported by UCB that would be nice to know.