public static void UpdateManifest() { if (!GoogleMobileAdSettings.Instance.KeepManifestClean) { return; } SA.Manifest.Manager.Refresh(); SA.Manifest.Template Manifest = SA.Manifest.Manager.GetManifest(); SA.Manifest.ApplicationTemplate application = Manifest.ApplicationTemplate; SA.Manifest.ActivityTemplate launcherActivity = application.GetLauncherActivity(); SA.Manifest.PropertyTemplate targetSdk = Manifest.GetOrCreatePropertyWithTag("uses-sdk"); targetSdk.SetValue("android:targetSdkVersion", "26"); SA.Manifest.ActivityTemplate AdActivity = application.GetOrCreateActivityWithName("com.google.android.gms.ads.AdActivity"); AdActivity.SetValue("android:configChanges", "keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"); AdActivity.SetValue("android:theme", "@android:style/Theme.Translucent"); if (launcherActivity != null) { SA.Manifest.PropertyTemplate ForwardNativeEventsToDalvik = launcherActivity.GetOrCreatePropertyWithName("meta-data", "unityplayer.ForwardNativeEventsToDalvik"); ForwardNativeEventsToDalvik.SetValue("android:value", "true"); } SA.Manifest.PropertyTemplate games_version = application.GetOrCreatePropertyWithName("meta-data", "com.google.android.gms.version"); #if UNITY_4_6 || UNITY_4_7 games_version.SetValue("android:value", GoogleMobileAdSettings.PLAY_SERVICE_VERSION_NUMBER); #else games_version.SetValue("android:value", "@integer/google_play_services_version"); #endif SA.Manifest.Manager.SaveManifest(); }
private void OnAddActivityClick(string activityName) { ActivityTemplate newActivity = new ActivityTemplate(false, activityName); newActivity.SetValue("android:name", activityName); newActivity.IsOpen = true; Manager.GetManifest().ApplicationTemplate.AddActivity(newActivity); }
public ActivityTemplate GetOrCreateActivityWithName(string name) { ActivityTemplate activity = GetActivityWithName(name); if (activity == null) { activity = new ActivityTemplate(false, name); AddActivity(activity); } return(activity); }
private static void ReadManifest(string manifestPath) { #if !(UNITY_WP8 || UNITY_METRO) //Read XML file _Template = new Template(); XmlDocument doc = new XmlDocument(); doc.Load(Application.dataPath + manifestPath); XmlNode rootNode = doc.DocumentElement; foreach (XmlAttribute attr in rootNode.Attributes) { _Template.SetValue(attr.Name, attr.Value); } foreach (XmlNode childNode in rootNode.ChildNodes) { if (!childNode.Name.Equals("application") && !childNode.Name.Equals("uses-permission") && !childNode.Name.Equals("#comment")) { _Template.AddProperty(childNode.Name, ParseProperty(childNode)); } } XmlNode applicationNode = null; foreach (XmlNode childNode in rootNode.ChildNodes) { if (childNode.Name.Equals("application")) { applicationNode = childNode; break; } } foreach (XmlAttribute attr in applicationNode.Attributes) { _Template.ApplicationTemplate.SetValue(attr.Name, attr.Value); } foreach (XmlNode childNode in applicationNode.ChildNodes) { if (!childNode.Name.Equals("#comment") && !childNode.Name.Equals("activity")) { _Template.ApplicationTemplate.AddProperty(childNode.Name, ParseProperty(childNode)); } } foreach (XmlNode childNode in applicationNode.ChildNodes) { if (childNode.Name.Equals("activity") && !childNode.Name.Equals("#comment")) { string activityName = ""; if (childNode.Attributes["android:name"] != null) { activityName = childNode.Attributes["android:name"].Value; } else { Debug.LogWarning("Android Manifest contains activity tag without android:name attribute."); } XmlNode launcher = null; bool isLauncher = false; foreach (XmlNode actNode in childNode.ChildNodes) { if (actNode.Name.Equals("intent-filter")) { foreach (XmlNode intentNode in actNode.ChildNodes) { if (intentNode.Name.Equals("category")) { if (intentNode.Attributes["android:name"].Value.Equals("android.intent.category.LAUNCHER")) { isLauncher = true; launcher = actNode; } } } } } ActivityTemplate activity = new ActivityTemplate(isLauncher, activityName); foreach (XmlAttribute attr in childNode.Attributes) { activity.SetValue(attr.Name, attr.Value); } foreach (XmlNode actNode in childNode.ChildNodes) { if (!actNode.Name.Equals("#comment")) { if (actNode != launcher) { activity.AddProperty(actNode.Name, ParseProperty(actNode)); } } } _Template.ApplicationTemplate.AddActivity(activity); } } //Load Manifest Permissions foreach (XmlNode node in rootNode.ChildNodes) { if (node.Name.Equals("uses-permission")) { PropertyTemplate permission = new PropertyTemplate("uses-permission"); permission.SetValue("android:name", node.Attributes["android:name"].Value); _Template.AddPermission(permission); } } #endif }
public static void UpdateManifest() { if (!SocialPlatfromSettings.Instance.KeepManifestClean) { return; } SA.Manifest.Manager.Refresh(); SA.Manifest.Template Manifest = SA.Manifest.Manager.GetManifest(); SA.Manifest.ApplicationTemplate application = Manifest.ApplicationTemplate; SA.Manifest.ActivityTemplate launcherActivity = application.GetLauncherActivity(); SA.Manifest.ActivityTemplate AndroidNativeProxy = application.GetOrCreateActivityWithName("com.androidnative.AndroidNativeProxy"); AndroidNativeProxy.SetValue("android:launchMode", "singleTask"); AndroidNativeProxy.SetValue("android:label", "@string/app_name"); AndroidNativeProxy.SetValue("android:configChanges", "fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"); AndroidNativeProxy.SetValue("android:theme", "@android:style/Theme.Translucent.NoTitleBar"); // Remove VIEW intent filter from AndroidNativeProxy activity if (AndroidNativeProxy != null) { SA.Manifest.PropertyTemplate intent_filter = AndroidNativeProxy.GetOrCreateIntentFilterWithName("android.intent.action.VIEW"); AndroidNativeProxy.RemoveProperty(intent_filter); } SA.Manifest.ActivityTemplate SocialProxyActivity = application.GetOrCreateActivityWithName("com.androidnative.features.social.common.SocialProxyActivity"); SocialProxyActivity.SetValue("android:launchMode", "singleTask"); SocialProxyActivity.SetValue("android:label", "@string/app_name"); SocialProxyActivity.SetValue("android:configChanges", "fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"); SocialProxyActivity.SetValue("android:theme", "@android:style/Theme.Translucent.NoTitleBar"); if (launcherActivity.Name == "com.androidnative.AndroidNativeBridge") { launcherActivity.SetName("com.unity3d.player.UnityPlayerNativeActivity"); } //////////////////////// //TwitterAPI //////////////////////// foreach (KeyValuePair <int, SA.Manifest.ActivityTemplate> entry in application.Activities) { //TODO get intents array SA.Manifest.ActivityTemplate act = entry.Value; SA.Manifest.PropertyTemplate intent = act.GetIntentFilterWithName("android.intent.action.VIEW"); if (intent != null) { SA.Manifest.PropertyTemplate data = intent.GetOrCreatePropertyWithTag("data"); if (data.GetValue("android:scheme") == "oauth") { act.RemoveProperty(intent); } } } if (SocialPlatfromSettings.Instance.TwitterAPI) { if (SocialProxyActivity != null) { SA.Manifest.PropertyTemplate intent_filter = SocialProxyActivity.GetOrCreateIntentFilterWithName("android.intent.action.VIEW"); intent_filter.GetOrCreatePropertyWithName("category", "android.intent.category.DEFAULT"); intent_filter.GetOrCreatePropertyWithName("category", "android.intent.category.BROWSABLE"); SA.Manifest.PropertyTemplate data = intent_filter.GetOrCreatePropertyWithTag("data"); data.SetValue("android:scheme", "oauth"); data.SetValue("android:host", PlayerSettings.bundleIdentifier); } } else { if (SocialProxyActivity != null) { SA.Manifest.PropertyTemplate intent_filter = SocialProxyActivity.GetOrCreateIntentFilterWithName("android.intent.action.VIEW"); SocialProxyActivity.RemoveProperty(intent_filter); } } //////////////////////// //FB API //////////////////////// SA.Manifest.PropertyTemplate ApplicationId_meta = application.GetOrCreatePropertyWithName("meta-data", "com.facebook.sdk.ApplicationId"); SA.Manifest.ActivityTemplate LoginActivity = application.GetOrCreateActivityWithName("com.facebook.LoginActivity"); SA.Manifest.ActivityTemplate FBUnityLoginActivity = application.GetOrCreateActivityWithName("com.facebook.unity.FBUnityLoginActivity"); SA.Manifest.ActivityTemplate FBUnityDeepLinkingActivity = application.GetOrCreateActivityWithName("com.facebook.unity.FBUnityDeepLinkingActivity"); SA.Manifest.ActivityTemplate FBUnityDialogsActivity = application.GetOrCreateActivityWithName("com.facebook.unity.FBUnityDialogsActivity"); //This activity used for Facebook SDK v7.x SA.Manifest.ActivityTemplate FacebookActivity = application.GetOrCreateActivityWithName("com.facebook.FacebookActivity"); if (Instalation.IsFacebookInstalled) { #if UNITY_ANDROID string FBAppId = "0"; try { ScriptableObject FB_Resourse = Resources.Load("FacebookSettings") as ScriptableObject; if (FB_Resourse != null) { Type fb_settings = FB_Resourse.GetType(); System.Reflection.PropertyInfo propert = fb_settings.GetProperty("AppId", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public); FBAppId = (string)propert.GetValue(null, null); } } catch (Exception ex) { Debug.LogError("AndroidNative. FBSettings.AppId reflection failed: " + ex.Message); } ApplicationId_meta.SetValue("android:value", "\\ " + FBAppId); LoginActivity.SetValue("android:label", "@string/app_name"); LoginActivity.SetValue("android:theme", "@android:style/Theme.Translucent.NoTitleBar"); LoginActivity.SetValue("android:configChanges", "keyboardHidden|orientation"); FBUnityLoginActivity.SetValue("android:theme", "@android:style/Theme.Translucent.NoTitleBar.Fullscreen"); FBUnityLoginActivity.SetValue("android:configChanges", "fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"); FBUnityDialogsActivity.SetValue("android:theme", "@android:style/Theme.Translucent.NoTitleBar.Fullscreen"); FBUnityDialogsActivity.SetValue("android:configChanges", "fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"); FBUnityDeepLinkingActivity.SetValue("android:exported", "true"); if (SA.Common.Config.FB_SDK_MajorVersionCode >= 7) { FacebookActivity.SetValue("android:configChanges", "keyboard|keyboardHidden|screenLayout|screenSize|orientation"); FacebookActivity.SetValue("android:theme", "@android:style/Theme.Translucent.NoTitleBar"); } else { application.RemoveActivity(FacebookActivity); } #endif } else { application.RemoveProperty(ApplicationId_meta); application.RemoveActivity(LoginActivity); application.RemoveActivity(FBUnityLoginActivity); application.RemoveActivity(FBUnityDeepLinkingActivity); application.RemoveActivity(FBUnityDialogsActivity); application.RemoveActivity(FacebookActivity); } //////////////////////// //NativeSharingAPI //////////////////////// SA.Manifest.PropertyTemplate provider = application.GetOrCreatePropertyWithName("provider", "android.support.v4.content.FileProvider"); if (SocialPlatfromSettings.Instance.NativeSharingAPI) { #if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6) //Remove FileProvider description from AndroidManifest.xml in Unity 5 application.RemoveProperty(provider); #else provider.SetValue("android:authorities", PlayerSettings.bundleIdentifier + ".fileprovider"); provider.SetValue("android:exported", "false"); provider.SetValue("android:grantUriPermissions", "true"); SA.Manifest.PropertyTemplate provider_meta = provider.GetOrCreatePropertyWithName("meta-data", "android.support.FILE_PROVIDER_PATHS"); provider_meta.SetValue("android:resource", "@xml/file_paths"); #endif } else { application.RemoveProperty(provider); } List <string> permissions = GetRequiredPermissions(); foreach (string p in permissions) { Manifest.AddPermission(p); } SA.Manifest.Manager.SaveManifest(); }
public void RemoveActivity(ActivityTemplate activity) { _activities.Remove(activity.Id); }
public void AddActivity(ActivityTemplate activity) { _activities.Add(activity.Id, activity); }
private void DrawProperties(BaseTemplate parent) { foreach (string key in parent.Properties.Keys) { foreach (PropertyTemplate property in parent.Properties[key]) { if (parent is ActivityTemplate) { ActivityTemplate activity = parent as ActivityTemplate; if (activity.IsLauncherProperty(property)) { continue; } } EditorGUILayout.Space(); EditorGUILayout.BeginVertical(GUI.skin.box, GUILayout.Height(27.0f)); EditorGUILayout.BeginHorizontal(); if (property.Values.ContainsKey("android:name")) { property.IsOpen = EditorGUILayout.Foldout(property.IsOpen, "[" + property.Tag + "] " + property.Values["android:name"]); } else { if (key.Equals("intent-filter")) { property.IsOpen = EditorGUILayout.Foldout(property.IsOpen, "[" + property.Tag + "] " + property.GetIntentFilterName(property)); } else { property.IsOpen = EditorGUILayout.Foldout(property.IsOpen, "[" + property.Tag + "]"); } } if (GUILayout.Button("X", GUILayout.Width(20.0f))) { parent.RemoveProperty(property); return; } EditorGUILayout.EndHorizontal(); if (property.IsOpen) { EditorGUILayout.BeginVertical(); foreach (string k in property.Values.Keys) { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); GUILayout.Label(k); EditorGUILayout.Space(); string input = property.Values[k]; EditorGUI.BeginChangeCheck(); if (k.Equals("android:name")) { input = GUILayout.TextField(property.Values[k], GUILayout.Width(224.0f)); } else { input = GUILayout.TextField(property.Values[k], GUILayout.Width(200.0f)); } if (EditorGUI.EndChangeCheck()) { property.SetValue(k, input); return; } if (GUILayout.Button("X", GUILayout.Width(20.0f))) { property.RemoveValue(k); return; } EditorGUILayout.EndHorizontal(); } DrawProperties(property); EditorGUILayout.Space(); EditorGUILayout.EndVertical(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Add Value", GUILayout.Width(100.0f))) { AddValueDialog(property); } if (GUILayout.Button("Add Property", GUILayout.Width(100.0f))) { AddPropertyDialog(property); } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } EditorGUILayout.EndVertical(); } } }
void OnGUI() { GUILayout.Label("Android Manifest Manager", EditorStyles.boldLabel); if (!Manager.HasManifest) { GUILayout.BeginHorizontal(); EditorGUILayout.Space(); GUILayout.Label("You have NO AndroidManifest file in your project!", GUILayout.Width(300.0f)); EditorGUILayout.Space(); GUILayout.EndHorizontal(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Create Default Manifest", new GUILayoutOption[] { GUILayout.Width(200.0f), GUILayout.Height(50.0f) })) { Manager.CreateDefaultManifest(); } EditorGUILayout.Space(); GUILayout.EndHorizontal(); } else { string[] toolbarButtons = new string[] { "Manifest", "Application", "Permissions" }; toolbarButtonIndex = GUILayout.Toolbar(toolbarButtonIndex, toolbarButtons, new GUILayoutOption[] { GUILayout.Height(30.0f) }); switch (toolbarButtons[toolbarButtonIndex]) { case "Manifest": { Template manifest = Manager.GetManifest(); if (manifest != null) { GUILayout.Label("Values", EditorStyles.boldLabel); foreach (string key in manifest.Values.Keys) { EditorGUILayout.BeginHorizontal(); GUILayout.Label(key); if (key.Equals("xmlns:android") || key.Equals("android:installLocation") || key.Equals("package") || key.Equals("android:versionName") || key.Equals("android:versionCode") || key.Equals("android:theme")) { GUI.enabled = false; GUILayout.TextField(Manager.GetManifest().Values[key], GUILayout.Width(300.0f)); } else { GUI.enabled = true; string input = Manager.GetManifest().Values[key]; EditorGUI.BeginChangeCheck(); input = GUILayout.TextField(Manager.GetManifest().Values[key], GUILayout.Width(276.0f)); if (EditorGUI.EndChangeCheck()) { Manager.GetManifest().SetValue(key, input); return; } if (GUILayout.Button("X", GUILayout.Width(20.0f))) { Manager.GetManifest().RemoveValue(key); return; } } GUI.enabled = true; EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Add Value", GUILayout.Width(100.0f))) { AddValueDialog(Manager.GetManifest()); } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); GUILayout.Label("Properties", EditorStyles.boldLabel); DrawProperties(Manager.GetManifest()); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Add Property", GUILayout.Width(100.0f))) { AddPropertyDialog(Manager.GetManifest()); } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button("Save Manifest", GUILayout.Height(22.0f))) { Manager.SaveManifest(); } } else { EditorGUILayout.HelpBox("Selected build platform DOESN'T support AndroidManifest.xml file", MessageType.Info); } } break; case "Application": { Template manifest = Manager.GetManifest(); if (manifest != null) { scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(position.width), GUILayout.Height(position.height - 50f)); GUILayout.Label("Values", EditorStyles.boldLabel); foreach (string key in manifest.ApplicationTemplate.Values.Keys) { EditorGUILayout.BeginHorizontal(); GUILayout.Label(key); string input = Manager.GetManifest().ApplicationTemplate.Values[key]; EditorGUI.BeginChangeCheck(); input = GUILayout.TextField(Manager.GetManifest().ApplicationTemplate.Values[key], GUILayout.Width(200.0f)); if (EditorGUI.EndChangeCheck()) { Manager.GetManifest().ApplicationTemplate.SetValue(key, input); return; } if (GUILayout.Button("X", GUILayout.Width(20.0f))) { Manager.GetManifest().ApplicationTemplate.RemoveValue(key); return; } EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Add Value", GUILayout.Width(100.0f))) { AddValueDialog(Manager.GetManifest().ApplicationTemplate); } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); GUILayout.Label("Activities", EditorStyles.boldLabel); int launcherActivities = 0; foreach (int id in Manager.GetManifest().ApplicationTemplate.Activities.Keys) { ActivityTemplate activity = Manager.GetManifest().ApplicationTemplate.Activities[id]; if (activity.IsLauncher) { launcherActivities++; } EditorGUILayout.BeginVertical(GUI.skin.box); EditorGUILayout.BeginHorizontal(); activity.IsOpen = EditorGUILayout.Foldout(activity.IsOpen, activity.Name); if (GUILayout.Button("X", GUILayout.Width(20.0f))) { Manager.GetManifest().ApplicationTemplate.RemoveActivity(activity); return; } EditorGUILayout.EndHorizontal(); if (activity.IsOpen) { EditorGUILayout.BeginVertical(); bool isLauncher = activity.IsLauncher; EditorGUI.BeginChangeCheck(); isLauncher = EditorGUILayout.Toggle("Is Launcher", activity.IsLauncher); if (EditorGUI.EndChangeCheck()) { activity.SetAsLauncher(isLauncher); } foreach (string k in activity.Values.Keys) { EditorGUILayout.BeginHorizontal(); GUILayout.Label(k); EditorGUILayout.Space(); string input = activity.Values[k]; EditorGUI.BeginChangeCheck(); if (k.Equals("android:name")) { input = GUILayout.TextField(activity.Values[k], GUILayout.Width(224.0f)); } else { input = GUILayout.TextField(activity.Values[k], GUILayout.Width(200.0f)); } if (EditorGUI.EndChangeCheck()) { activity.SetValue(k, input); return; } if (!k.Equals("android:name")) { if (GUILayout.Button("X", GUILayout.Width(20.0f))) { activity.RemoveValue(k); return; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } DrawProperties(activity); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Add Value", GUILayout.Width(100.0f))) { AddValueDialog(activity); } if (GUILayout.Button("Add Property", GUILayout.Width(100.0f))) { AddPropertyDialog(activity); } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Add Activity", GUILayout.Width(100.0f))) { AddPermissionDialog dlg = EditorWindow.CreateInstance <AddPermissionDialog>(); dlg.onClose += OnPermissionDlgClose; dlg.onAddClick += OnAddActivityClick; #if UNITY_5 && !UNITY_5_0 dlg.titleContent.text = "Add Activity"; #else dlg.title = "Add Activity"; #endif dlg.ShowAuxWindow(); } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); if (launcherActivities > 1) { EditorGUILayout.HelpBox("There is MORE THAN ONE Launcher Activity in Manifest", MessageType.Warning); } else if (launcherActivities < 1) { EditorGUILayout.HelpBox("There is NO Launcher Activities in Manifest", MessageType.Warning); } GUILayout.Label("Properties", EditorStyles.boldLabel); DrawProperties(Manager.GetManifest().ApplicationTemplate); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Add Property", GUILayout.Width(100.0f))) { AddPropertyDialog(Manager.GetManifest().ApplicationTemplate); } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.EndScrollView(); } else { EditorGUILayout.HelpBox("Selected build platform DOESN'T support AndroidManifest.xml file", MessageType.Info); } } break; case "Permissions": { Template manifest = Manager.GetManifest(); if (manifest != null) { scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(position.width), GUILayout.Height(position.height - 50f)); EditorGUILayout.BeginVertical(); foreach (PropertyTemplate permission in Manager.GetManifest().Permissions) { EditorGUILayout.BeginHorizontal(GUI.skin.box); EditorGUILayout.LabelField(permission.Values["android:name"]); if (GUILayout.Button("X", GUILayout.Width(20.0f))) { Manager.GetManifest().RemovePermission(permission); return; } EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Add Android Permission")) { GenericMenu permissionsMenu = new GenericMenu(); foreach (string pStr in PermissionsStrings) { permissionsMenu.AddItem(new GUIContent(pStr), false, SelectPermission, pStr); } permissionsMenu.ShowAsContext(); } if (GUILayout.Button("Add Other Permission")) { AddPermissionDialog dlg = EditorWindow.CreateInstance <AddPermissionDialog>(); dlg.onClose += OnPermissionDlgClose; dlg.onAddClick += OnAddPermissionClick; #if UNITY_5 && !UNITY_5_0 dlg.titleContent.text = "Add Permission"; #else dlg.title = "Add Permission"; #endif dlg.ShowAuxWindow(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.EndVertical(); EditorGUILayout.EndScrollView(); } else { EditorGUILayout.HelpBox("Selected build platform DOESN'T support AndroidManifest.xml file", MessageType.Info); } } break; default: break; } AboutGUI(); } }