/// <summary> /// Configures the project to prepare for building the specified scenes in an instant app. /// </summary> public static void ConfigureProject(string[] scenesInBuild) { var requiredPolicies = PlayInstantSettingPolicy.GetRequiredPolicies(); foreach (var policy in requiredPolicies) { var policyChangeCompleted = policy.ChangeState(); if (!policyChangeCompleted) { throw new Exception(string.Format("Failed to change policy: {0}", policy.Name)); } } SetTargetArchitectures(); var manifestUpdater = AndroidManifestHelper.GetAndroidManifestUpdater(); var errorMessage = manifestUpdater.SwitchToInstant(null); if (errorMessage != null) { throw new Exception(string.Format("Error updating AndroidManifest.xml: {0}", errorMessage)); } PlayInstantBuildConfiguration.AddScriptingDefineSymbol( PlaySignatureVerifier.SkipVerifyGooglePlayServicesScriptingDefineSymbol); PlayInstantBuildConfiguration.SaveConfiguration("", scenesInBuild, ""); PlayInstantBuildConfiguration.SetInstantBuildType(); }
private void SelectPlatformInstant() { Uri uri = null; _instantUrl = _instantUrl == null ? string.Empty : _instantUrl.Trim(); if (_instantUrl.Length > 0) { try { // TODO: allow port numbers? allow query parameters? uri = new Uri(_instantUrl); } catch (Exception ex) { DisplayUrlError(string.Format("The URL is invalid: {0}", ex.Message)); return; } if (uri.Scheme.ToLower() != "https") { DisplayUrlError("The URL scheme should be \"https\""); return; } if (string.IsNullOrEmpty(uri.Host)) { DisplayUrlError("If a URL is provided, the host must be specified"); return; } } var errorMessage = _androidManifestUpdater.SwitchToInstant(uri); if (errorMessage != null) { var message = string.Format("Error updating AndroidManifest.xml: {0}", errorMessage); Debug.LogError(message); EditorUtility.DisplayDialog("Error Saving", message, "OK"); return; } var scenesInBuild = _scenesInBuild.Split(',').Where(s => s.Trim().Length > 0).Select(s => s.Trim()).ToArray(); _scenesInBuild = GetScenesInBuildAsString(scenesInBuild); _assetBundleManifestPath = _assetBundleManifestPath.Trim(); PlayInstantBuildConfiguration.SaveConfiguration(_instantUrl, scenesInBuild, _assetBundleManifestPath); PlayInstantBuildConfiguration.SetInstantBuildType(); // If a TextField is in focus, it won't update to reflect the Trim(). So reassign focus to controlID 0. GUIUtility.keyboardControl = 0; Repaint(); }
private void SelectPlatformInstant() { string instantUrlError; var uri = GetInstantUri(_instantUrl, out instantUrlError); if (instantUrlError != null) { Debug.LogErrorFormat("Invalid URL: {0}", instantUrlError); EditorUtility.DisplayDialog("Invalid URL", instantUrlError, WindowUtils.OkButtonText); return; } // The URL is valid, so save any clean-ups performed by conversion through Uri, e.g. HTTPS->https. _instantUrl = uri == null ? string.Empty : uri.ToString(); var errorMessage = _androidManifestUpdater.SwitchToInstant(uri); if (errorMessage != null) { var message = string.Format("Error updating AndroidManifest.xml: {0}", errorMessage); Debug.LogError(message); EditorUtility.DisplayDialog("Error Saving", message, WindowUtils.OkButtonText); return; } var scenesInBuild = _scenesInBuild.Split(',').Where(s => s.Trim().Length > 0).Select(s => s.Trim()).ToArray(); _scenesInBuild = GetScenesInBuildAsString(scenesInBuild); _assetBundleManifestPath = _assetBundleManifestPath.Trim(); PlayInstantBuildConfiguration.SaveConfiguration(_instantUrl, scenesInBuild, _assetBundleManifestPath); PlayInstantBuildConfiguration.SetInstantBuildType(); Debug.Log("Saved Play Instant Build Settings."); // If a TextField is in focus, it won't update to reflect the Trim(). So reassign focus to controlID 0. GUIUtility.keyboardControl = 0; Repaint(); }