Ejemplo n.º 1
0
        private void InitEnvironmentDetails()
        {
            var environmentBuilder = new StringBuilder("Environment Details: ")
                                     .Append("Unity - ").Append(Application.unityVersion).Append("; ")
                                     .Append("Platform - ").Append(Application.platform).Append("; ");

            if (edmVersion != null)
            {
                environmentBuilder.Append("EDM4U - ").Append(edmVersion).Append("; ");
            }
#if UNITY_ANDROID
            if (platform == BuildTarget.Android)
            {
                var gradleWrapperVersion = CASPreprocessGradle.GetGradleWrapperVersion();
                if (gradleWrapperVersion != null)
                {
                    environmentBuilder.Append("Gradle Wrapper - ").Append(gradleWrapperVersion).Append("; ");
                }
                var targetSDK = ( int )PlayerSettings.Android.targetSdkVersion;
                if (targetSDK == 0)
                {
                    environmentBuilder.Append("Target SDK - Auto; ");
                }
                else
                {
                    environmentBuilder.Append("Target SDK - ").Append(targetSDK).Append("; ");
                }
            }
#endif
            environmentDetails = environmentBuilder.ToString();
        }
Ejemplo n.º 2
0
        private void OnGradleTemplateDisabledGUI(string prefix, string path)
        {
            if (File.Exists(path))
            {
                return;
            }
#if UNITY_ANDROID || CASDeveloper
            var msg = prefix + " template feature is disabled!\n" +
                      "A successful build requires do modifications to " + prefix + " template.";
            if (HelpStyles.WarningWithButton(msg, "Enable", MessageType.Error))
            {
                CASPreprocessGradle.TryEnableGradleTemplate(path);
            }
#endif
        }
        private static void ConfigureAndroid(CASInitSettings settings, CASEditorSettings editorSettings, string admobAppId)
        {
#if UNITY_ANDROID || CASDeveloper
            EditorUtility.DisplayProgressBar(casTitle, "Validate CAS Android Build Settings", 0.8f);

            const string deprecatedPluginPath = "Assets/Plugins/CAS";
            if (AssetDatabase.IsValidFolder(deprecatedPluginPath))
            {
                AssetDatabase.DeleteAsset(deprecatedPluginPath);
                Debug.Log("Removed deprecated plugin: " + deprecatedPluginPath);
            }

            HashSet <string> promoAlias = new HashSet <string>();
            if (editorSettings.generateAndroidQuerriesForPromo)
            {
                for (int i = 0; i < settings.managersCount; i++)
                {
                    Utils.GetCrossPromoAlias(BuildTarget.Android, settings.GetManagerId(i), promoAlias);
                }
            }

            UpdateAndroidPluginManifest(admobAppId, promoAlias, editorSettings);

            CASPreprocessGradle.Configure(editorSettings);

#if !UNITY_2021_2_OR_NEWER
            // 19 - AndroidSdkVersions.AndroidApiLevel19
            // Deprecated in Unity 2021.2
            if (PlayerSettings.Android.minSdkVersion < ( AndroidSdkVersions )19)
            {
                Utils.DialogOrCancelBuild("CAS required a higher minimum SDK API level. Set SDK level 19 (KitKat) and continue?", BuildTarget.NoTarget);
                PlayerSettings.Android.minSdkVersion = ( AndroidSdkVersions )19;
            }
#endif
#endif
        }