Version: 5.6
Construya un manifest como un JSON
Cloud Build REST API

Manifest de construcción como ScriptableObject

BuildManifestObject es un ScriptableObject que puede utilizar para acceder a valores en el Manifest de construcción mediante script, sin la necesidad de cargar el UnityCloudBuildManifest.json TextAsset.

Es un parámetro opcional para la preexportación invocada por Unity Cloud Build, si el UnityCloudBuildManifest.json TextAsset no se ha escrito. (Consulte la documentación sobre Manifest como JSON.)

El siguiente código de ejemplo C# muestra un método de preexportación que actualiza bundleVersion enPlayerSettings en función del buildNumber provisto en el manifiesto. Para obtener más información acerca de los métodos previos a la exportación, consulte la documentación sobre Métodos de exportación previa y posterior.

using UnityEngine;
using UnityEditor;
using System;

public class CloudBuildHelper : MonoBehaviour
{
    public static void PreExport(UnityEngine.CloudBuild.BuildManifestObject manifest)
    {
        PlayerSettings.bundleVersion = String.Format("1.0.{0}", manifest.GetValue("buildNumber", "unknown"));
    }
}

Esta es la interfaz pública para la clase BuildManifestObject:


namespace UnityEngine.CloudBuild
{
    public class BuildManifestObject : ScriptableObject
    {
        // Try to get a manifest value - returns true if key was found and could be cast to type T, otherwise returns false.
        public bool TryGetValue<T>(string key, out T result);
        // Retrieve a manifest value or throw an exception if the given key isn't found.
        public T GetValue<T>(string key);
        // Set the value for a given key.
        public void SetValue(string key, object value);
        // Copy values from a dictionary. ToString() will be called on dictionary values before being stored.
        public void SetValues(Dictionary<string, object> sourceDict);
        // Remove all key/value pairs.
        public void ClearValues();
        // Return a dictionary that represents the current BuildManifestObject.
        public Dictionary<string, object> ToDictionary();
        // Return a JSON formatted string that represents the current BuildManifestObject
        public string ToJson();
        // Return an INI formatted string that represents the current BuildManifestObject
        public override string ToString();
    }
}
Construya un manifest como un JSON
Cloud Build REST API