/// <summary> /// Overrides the postprocess method to revert the AndroidProductInfo changes to the PlayerSettings. /// <summary> override public void Postprocess(string buildPath) { base.Postprocess(buildPath); AndroidProductInfo info; info = PlatformUtil.GetSettings <AndroidProductInfo>(); if (info) { // restore player settings PlayerSettings.productName = this.ProductName; PlayerSettings.SetApplicationIdentifier(BuildTargetGroup, this.BundleIdentifier); PlayerSettings.bundleVersion = this.BundleVersion; PlayerSettings.Android.bundleVersionCode = this.BundleVersionCode; PlayerSettings.Android.minSdkVersion = this.SdkVersion; // clear player settings this.ProductName = null; this.BundleIdentifier = null; this.BundleVersion = null; this.BundleVersionCode = 0; this.SdkVersion = default(AndroidSdkVersions); } }
void OnGUI() { if (SceneNavigator.Instance && SceneNavigator.Instance.IsReady) { GUIStyle style; style = new GUIStyle(GUI.skin.label); style.alignment = TextAnchor.MiddleCenter; style.fontSize = 18; style.normal.textColor = new Color(0f, 0f, 0f, 0.5f); Rect rect; rect = new Rect(0, 0, Screen.width, Screen.height); ProductInfo info; info = PlatformUtil.GetSettings <ProductInfo>(); string name; name = info ? info.DisplayName : "this app"; string text; text = string.Format("This version of {0} has been created specifically for demonstration purposes.", name); GUILayout.BeginArea(rect); GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(text, style, GUILayout.Width(Screen.width), GUILayout.Height(rect.height * 0.2f)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndArea(); } }
public static void OnPreprocess(IBuildProcessor processor) { ProductInfo info; info = PlatformUtil.GetSettings <ProductInfo>(); if (info) { ComputeAnalyticsNameOverride(info); } }
/// <summary> /// Updates the info plist. /// </summary> protected virtual void PostprocessXcodePlist() { // read plist Dictionary <string, object> dict; dict = ReadPlist(); // cleanup plist dict.Remove("CFBundleIconFiles"); // remove default launch image entries from the plist - // otherwise we get a black launch screen. // without these values, launch uses our LaunchScreen.xib file (white screen) dict.Remove("UILaunchStoryboardName~ipad"); dict.Remove("UILaunchStoryboardName~iphone"); dict.Remove("UILaunchStoryboardName~ipod"); // update plist dict["UIPrerenderedIcon"] = true; dict["CFBundleAllowMixedLocalizations"] = true; iOSProductInfo productInfo = PlatformUtil.GetSettings <iOSProductInfo>(SagoPlatform.PlatformUtil.ActivePlatform); object urlScheme = productInfo.UrlScheme; dict["CFBundleURLTypes"] = new List <object> { new Dictionary <string, object> { { "CFBundleURLName", PlayerSettings.applicationIdentifier }, { "CFBundleURLSchemes", new List <object> { urlScheme } } } }; dict["LSApplicationQueriesSchemes"] = iOSLSApplicationQueriesSchemes.Schemes; dict["CFBundleShortVersionString"] = this.BundleShortVersion; dict["CFBundleVersion"] = this.BundleVersion; dict["UILaunchStoryboardName"] = "LaunchScreen"; // Inform App Store submission/Testflight that we do not use any non-standard encryption. dict["ITSAppUsesNonExemptEncryption"] = false; dict["NSPhotoLibraryUsageDescription"] = "This app would like to save photos to your camera roll."; dict["LSHasLocalizedDisplayName"] = true; // write plist WritePlist(dict); }
protected virtual void PreprocessPlayerSettings() { tvOSProductInfo info = PlatformUtil.GetSettings <tvOSProductInfo>(); #if !SAGO_BUILD_DO_NOT_USE_VERSION_SERVICE if (!VersionService.Bump(info)) { Debug.LogWarning("Could not bump build number.", info); switch (this.BuildType) { case tvOSBuildType.Simulator: case tvOSBuildType.Device: Debug.LogWarning("Could not bump build number"); break; default: throw new System.InvalidOperationException("Could not bump build number"); } } #endif PlayerSettings.productName = info.DisplayName; PlayerSettings.bundleIdentifier = info.Identifier; PlayerSettings.bundleVersion = this.BundleVersion; if (string.IsNullOrEmpty(info.UrlScheme)) { throw new System.Exception("UrlScheme property is missing from tvOS platform prefab"); } // short bundle version // the short bundle version property was added in Unity 4.6.3, so // set it via reflection to play nice with older versions of Unity. PropertyInfo shortBundleVersion = typeof(PlayerSettings).GetProperty( "shortBundleVersion", BindingFlags.Public | BindingFlags.Static ); if (shortBundleVersion != null) { shortBundleVersion.SetValue(null, this.BundleShortVersion, null); } }
/// <summary> /// Overrides the preprocess method to apply AndroidProductInfo to the PlayerSettings. /// <summary> override public void Preprocess() { base.Preprocess(); AndroidProductInfo info; info = PlatformUtil.GetSettings <AndroidProductInfo>(); #if !SAGO_BUILD_DO_NOT_USE_VERSION_SERVICE if (!VersionService.Bump(info)) { throw new System.InvalidOperationException("Could not bump build number."); } #endif if (info) { // store the player settings this.ProductName = PlayerSettings.productName; this.BuildTargetGroup = EditorUserBuildSettings.activeBuildTarget.ConvertToGroup(); this.BundleIdentifier = PlayerSettings.applicationIdentifier; this.BundleVersion = PlayerSettings.bundleVersion; this.BundleVersionCode = PlayerSettings.Android.bundleVersionCode; this.SdkVersion = PlayerSettings.Android.minSdkVersion; // copy product info to player settings PlayerSettings.productName = info.DisplayName; PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, info.Identifier); PlayerSettings.bundleVersion = ProductInfo.CheckVersion(info.Version); PlayerSettings.Android.bundleVersionCode = ProductInfo.CheckBuild(info.Build); PlayerSettings.Android.minSdkVersion = (AndroidSdkVersions)info.SdkVersion; } #if !UNITY_CLOUD_BUILD && TEAMCITY_BUILD #if SAGO_ANDROID_USE_GRADLE_BUILD_SYSTEM EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle; #else EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Internal; #endif #endif }
/// <summary> /// Updates the info plist. /// </summary> protected virtual void PostprocessXcodePlist() { // read plist Dictionary <string, object> dict; dict = ReadPlist(); // cleanup plist dict.Remove("CFBundleIconFiles"); // update plist dict["UIPrerenderedIcon"] = true; dict["CFBundleAllowMixedLocalizations"] = true; tvOSProductInfo productInfo = PlatformUtil.GetSettings <tvOSProductInfo>(SagoPlatform.PlatformUtil.ActivePlatform); object urlScheme = productInfo.UrlScheme; dict["CFBundleURLTypes"] = new List <object> { new Dictionary <string, object> { { "CFBundleURLName", PlayerSettings.iPhoneBundleIdentifier }, { "CFBundleURLSchemes", new List <object> { urlScheme } } } }; dict["LSApplicationQueriesSchemes"] = SagoBuildEditor.iOS.iOSLSApplicationQueriesSchemes.Schemes; dict["CFBundleShortVersionString"] = this.BundleShortVersion; dict["CFBundleVersion"] = this.BundleVersion; dict["UILaunchStoryboardName"] = "LaunchScreen"; // Inform App Store submission/Testflight that we do not use any non-standard encryption. dict["ITSAppUsesNonExemptEncryption"] = false; // write plist WritePlist(dict); }
/// <summary> /// Overrides the preprocess method to apply AndroidProductInfo to the PlayerSettings. /// <summary> override public void Preprocess() { base.Preprocess(); GooglePlayProductInfo info; info = PlatformUtil.GetSettings <GooglePlayProductInfo>(); bool shouldUseExpansionFiles = ShouldUseExpansionFiles; if (info != null) { PlayerSettings.Android.useAPKExpansionFiles = shouldUseExpansionFiles; } // Check if the license key is provided. if (shouldUseExpansionFiles && string.IsNullOrEmpty(info.LicensePublicKey)) { throw new System.Exception("License Public Key is missing"); } Debug.Log("GooglePlayDownloaderDebugMode=" + info.GooglePlayDownloaderDebugMode + " UseExpansionFile=" + shouldUseExpansionFiles + " LicensePublicKey=" + info.LicensePublicKey); }
public static void UpdateGooglePlayProjectResources(Platform oldPlatform, Platform newPlatform) { bool defineSymbolSagoGooglePlayExpansionDownloader = false; #if SAGO_GOOGLE_PLAY_EXPANSION_DOWNLOADER defineSymbolSagoGooglePlayExpansionDownloader = true; #endif GooglePlayProductInfo productInfo = null; if (newPlatform == Platform.GooglePlay) { productInfo = PlatformUtil.GetSettings <GooglePlayProductInfo>(Platform.GooglePlay); } else if (newPlatform == Platform.GooglePlayFree) { productInfo = PlatformUtil.GetSettings <GooglePlayProductInfo>(Platform.GooglePlayFree); } if (productInfo != null) { UpdateStringsXml(productInfo, newPlatform); } }
void Start() { #if UNITY_EDITOR ProductInfo productInfo = PlatformUtil.GetSettings <ProductInfo>(PlatformUtil.ActivePlatform); if (productInfo != null) { VersionText = string.Format("{0}.{1} ({2}) built with Unity {3}", productInfo.Version, productInfo.Build, PlatformUtil.ActivePlatform, Application.unityVersion); } else { VersionText = "Version info not found."; } #elif UNITY_ANDROID VersionText = string.Format("{0}.{1} ({2}) built with Unity {3}", SagoBiz.Controller.Instance.Native.BundleVersion, SagoBiz.Controller.Instance.Native.BundleVersionCode, PlatformUtil.ActivePlatform, Application.unityVersion); #elif !SAGO_DISABLE_SAGOBIZ && UNITY_IOS VersionText = string.Format("{0} ({1}) built with Unity {2}", SagoBiz.Controller.Instance.Native.BundleVersionCode, PlatformUtil.ActivePlatform, Application.unityVersion); #endif TextAsset manifest = Resources.Load <TextAsset>("UnityCloudBuildManifest.json"); if (manifest) { this.CloudBuildInfo = JsonConvert.DeserializeObject <Dictionary <string, string> >(manifest.text); } }