public static void SetiOSFrameworkDependency() { string[] utils = AssetDatabase.FindAssets("iOSUtils"); if (utils.Length > 0) { string path = AssetDatabase.GUIDToAssetPath(utils [0]); FrameworkDependency.AddFrameworkDependency(path, BuildTarget.iOS, "Photos"); } }
public void DrawUsage() { // Title m_Config.m_ShowUsage = EditorGUILayout.Foldout(m_Config.m_ShowUsage, "Permissions".ToUpper()); if (m_Config.m_ShowUsage == false) { return; } PhotoUsageDescription usage = AssetUtils.GetOrCreate <PhotoUsageDescription> ("iOSPhotoUsageDescription.asset"); if (usage == null) { return; } // Exclude from build EditorGUILayout.Separator(); if (usage.m_NeedsPermission) { if (!permissionChecked) { permissionChecked = true; FrameworkDependency.SetiOSFrameworkDependency(); } EditorGUILayout.HelpBox("Currently, your iOS and Android builds REQUIER the access to the device and photo gallery. " + "If you only want to use the asset in editor or do not requier to access to the device gallery, use the button below. ", MessageType.Info); if (GUILayout.Button("Remove permission needs for iOS and Android")) { RemovePermissionNeeds.Remove(true); usage.m_NeedsPermission = false; } EditorGUILayout.LabelField("iOS Photo library usage description:"); string newUsage = EditorGUILayout.TextArea(usage.m_UsageDescription, EditorStyles.textArea); if (newUsage != usage.m_UsageDescription) { usage.m_UsageDescription = newUsage; EditorUtility.SetDirty(usage); } } else { EditorGUILayout.HelpBox("Currently, your iOS and Android builds DO NOT REQUIER the access to the device and photo gallery. " + "However, it is now impossible to access the device gallery from build.", MessageType.Info); if (GUILayout.Button("Restore permission needs for iOS and Android")) { RemovePermissionNeeds.Remove(false); usage.m_NeedsPermission = true; } } }
public static void Remove(bool exclude = true) { if (exclude) { Debug.Log("Removing permission needs for iOS and Android."); } else { Debug.Log("Restoring permission needs for iOS and Android."); } // Plugin files string[] utils = AssetDatabase.FindAssets("iOSUtils"); for (int i = 0; i < utils.Length; ++i) { string path = AssetDatabase.GUIDToAssetPath(utils [i]); if (!path.Contains("iOSUtils.m")) { continue; } string newPath = ""; if (exclude) { newPath = path.Replace(".m", ".m.bk"); } else { newPath = path.Replace(".bk", ""); } Debug.Log("Moving iOS plugin " + path + " to " + newPath); File.Move(path, newPath); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } if (!exclude) { FrameworkDependency.SetiOSFrameworkDependency(); } // Symbols if (exclude) { UnityEditor.PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, UnityEditor.PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android) + ";IGNORE_ANDROID_SCREENSHOT"); UnityEditor.PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, UnityEditor.PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS) + ";IGNORE_IOS_SCREENSHOT"); } else { UnityEditor.PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, UnityEditor.PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android).Replace("IGNORE_ANDROID_SCREENSHOT", "")); UnityEditor.PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, UnityEditor.PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS).Replace("IGNORE_IOS_SCREENSHOT", "")); } Debug.Log("Android player define symbols: " + UnityEditor.PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android)); Debug.Log("iOS player define symbols: " + UnityEditor.PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS)); }
public static void SetiOSFrameworkDependency() { string[] utils = AssetDatabase.FindAssets("iOSUtils"); if (utils.Length > 0) { for (int i = 0; i < utils.Length; ++i) { string path = AssetDatabase.GUIDToAssetPath(utils[i]); if (path.Contains("iOSUtils.m")) { FrameworkDependency.AddFrameworkDependency(path, BuildTarget.iOS, "Photos"); } } } }
public void OnPreprocessBuild(BuildReport report) { FrameworkDependency.SetiOSFrameworkDependency(); }
public void DrawUsage() { // Title m_Config.m_ShowUsage = EditorGUILayout.Foldout(m_Config.m_ShowUsage, "Permissions".ToUpper()); if (m_Config.m_ShowUsage == false) { return; } if (usage == null) { usage = AssetUtils.GetFirstOrCreate <PhotoUsageDescription>("iOSPhotoUsageDescription", "Assets/"); } if (usage == null) { return; } /* * // Exlude from build * EditorGUILayout.Separator (); * EditorGUILayout.LabelField ("Editor Only"); * if (!usage.m_EditorOnly) { * EditorGUILayout.HelpBox ("If you want to use the asset in editor only, use the button below to exclude it from build. " + * "Be careful not to use any scripts in builds to prevent errors.", MessageType.Info); * if (GUILayout.Button ("Switch to editor only")) { * ExcludeFromBuild.Exclude (true); * usage.m_EditorOnly = true; * } * } else { * EditorGUILayout.HelpBox ("The asset is currently in Editor Only mode. Use the button below to restore the asset in build mode.", MessageType.Info); * if (GUILayout.Button ("Switch to build mode")) { * ExcludeFromBuild.Exclude (false); * usage.m_EditorOnly = false; * } * } */ // Add framework dependency to iOS if (!permissionChecked) { permissionChecked = true; FrameworkDependency.SetiOSFrameworkDependency(); } // Exclude from iOS and Android EditorGUILayout.Separator(); EditorGUILayout.Separator(); EditorGUILayout.LabelField("iOS and Android Gallery permissions"); if (usage.m_NeedsPermission) { EditorGUILayout.HelpBox("Currently, your iOS and Android builds REQUIER the access to the device and photo gallery. " + "If you only want to use the asset in editor or do not requier to access to the device gallery, use the button below. ", MessageType.Info); if (GUILayout.Button("Remove permission needs for iOS and Android")) { RemovePermissionNeeds.Remove(true); usage.m_NeedsPermission = false; } EditorGUILayout.LabelField("iOS Photo library usage description:"); string newUsage = EditorGUILayout.TextArea(usage.m_UsageDescription, EditorStyles.textArea); if (newUsage != usage.m_UsageDescription) { usage.m_UsageDescription = newUsage; EditorUtility.SetDirty(usage); } } else { EditorGUILayout.HelpBox("Currently, your iOS and Android builds DO NOT REQUIER the access to the device and photo gallery. " + "However, it is now impossible to access the device gallery from build.", MessageType.Info); if (GUILayout.Button("Restore permission needs for iOS and Android")) { RemovePermissionNeeds.Remove(false); usage.m_NeedsPermission = true; } } }