Example #1
0
        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
        }