private static string UpdateRemoteSettingsAndGetAppId(CASInitSettings settings, BuildTarget platform, DependencyManager deps) { string appId = null; string updateSettingsError = ""; for (int i = 0; i < settings.managersCount; i++) { var managerId = settings.GetManagerId(i); if (managerId == null || managerId.Length < 5) { continue; } try { string newAppId = DownloadRemoteSettings(managerId, platform, settings, deps); if (!string.IsNullOrEmpty(appId) || string.IsNullOrEmpty(newAppId)) { continue; } if (newAppId.Contains('~')) { appId = newAppId; continue; } if (i == 0) { Debug.LogError(Utils.logTag + "CAS id [" + managerId + "] has an error in server settings. Please contact support!"); } } catch (Exception e) { updateSettingsError = e.Message; } } if (!string.IsNullOrEmpty(appId) || settings.IsTestAdMode()) { return(appId); } const string title = "Update CAS remote settings"; int dialogResponse = 0; var targetId = settings.GetManagerId(0); var message = updateSettingsError + "\nPlease try using a real identifier in the first place else contact support." + "\n- Warning! -" + "\n1. Continue build the app for release with current settings can reduce monetization revenue." + "\n2. When build to testing your app, make sure you use Test Ads mode rather than live ads. " + "Failure to do so can lead to suspension of your account."; Debug.LogError(Utils.logTag + message); if (!Application.isBatchMode) { dialogResponse = EditorUtility.DisplayDialogComplex(title, message, "Continue", "Cancel Build", "Select settings file"); } if (dialogResponse == 0) { var cachePath = Utils.GetNativeSettingsPath(platform, targetId); if (File.Exists(cachePath)) { return(Utils.GetAdmobAppIdFromJson(File.ReadAllText(cachePath))); } return(null); } if (dialogResponse == 1) { Utils.StopBuildWithMessage("Build canceled", BuildTarget.NoTarget); return(null); } return(Utils.SelectSettingsFileAndGetAppId(targetId, platform)); }