public void PreprocessBuild(BuildTarget target, Platform.BinaryType binaryType) { Platform platform = PlatformForBuildTarget[target]; PreprocessStaticPlugins(platform, target); SelectBinaries(platform, target, binaryType); }
private void PreprocessBuild(BuildTarget target, Platform.BinaryType binaryType) { Platform platform = PlatformForBuildTarget[target]; PreprocessStaticPlugins(platform, target); #if UNITY_2018_1_OR_NEWER SelectBinaries(platform, target, binaryType); #endif }
public bool CanBuildTarget(BuildTarget target, Platform.BinaryType binaryType, out string error) { if (Settings.Instance == null) { error = "Settings instance has not been initialized. Unable to continue build."; return(false); } Platform platform; if (!PlatformForBuildTarget.TryGetValue(target, out platform)) { error = string.Format("No FMOD platform found for build target {0}.\n" + "You may need to install a platform specific integration package from {1}.", target, DownloadURL); return(false); } IEnumerable <string> missingPathsQuery = platform.GetBinaryFilePaths(target, binaryType) .Where(path => !File.Exists(path) && !Directory.Exists(path)); if (missingPathsQuery.Any()) { string[] missingPaths = missingPathsQuery.Select(path => "- " + path).ToArray(); string summary; if (missingPaths.Length == 1) { summary = string.Format("There is an FMOD binary missing for build target {0}", target); } else { summary = string.Format("There are {0} FMOD binaries missing for build target {1}", missingPaths.Length, target); } if (binaryType == Platform.BinaryType.Logging) { summary += " (development build)"; } error = string.Format( "{0}:\n" + "{1}\n" + "Please run the {2} menu command.\n", summary, string.Join("\n", missingPaths), FileReorganizer.ReorganizerMenuItemPath); return(false); } error = null; return(true); }
private bool CanBuildTarget(BuildTarget target, Platform.BinaryType binaryType, out string error) { const string DownloadURL = "https://www.fmod.com/download"; Platform platform; if (!PlatformForBuildTarget.TryGetValue(target, out platform)) { error = string.Format("No FMOD platform found for build target {0}.\n" + "You may need to install a platform specific integration package from {1}.", target, DownloadURL); return(false); } IEnumerable <string> missingPathsQuery = platform.GetBinaryFilePaths(target, binaryType) .Where(path => !File.Exists(path) && !Directory.Exists(path)); if (missingPathsQuery.Any()) { string[] missingPaths = missingPathsQuery.Select(path => "- " + path).ToArray(); string summary; if (missingPaths.Length == 1) { summary = string.Format("There is an FMOD binary missing for build target {0}", target); } else { summary = string.Format("There are {0} FMOD binaries missing for build target {1}", missingPaths.Length, target); } if (binaryType == Platform.BinaryType.Logging) { summary += " (development build)"; } error = string.Format( "{0}:\n" + "{1}\n" + "You may need to reinstall the relevant integration package from {2}.\n", summary, string.Join("\n", missingPaths), DownloadURL); return(false); } error = null; return(true); }
private static void SelectBinaries(Platform platform, BuildTarget target, Platform.BinaryType binaryType) { string message = string.Format("FMOD: Selected binaries for platform {0}{1}:", target, (binaryType == Platform.BinaryType.Logging) ? " (development build)" : string.Empty); Instance.binaryCompatibilitiesBeforeBuild = new Dictionary <string, bool>(); HashSet <string> enabledPaths = new HashSet <string>(); foreach (string path in platform.GetBinaryAssetPaths(target, binaryType | Platform.BinaryType.Optional)) { PluginImporter importer = AssetImporter.GetAtPath(path) as PluginImporter; if (importer is PluginImporter) { Instance.binaryCompatibilitiesBeforeBuild.Add(path, importer.GetCompatibleWithPlatform(target)); importer.SetCompatibleWithPlatform(target, true); enabledPaths.Add(path); message += string.Format("\n- Enabled {0}", path); } } foreach (string path in platform.GetBinaryAssetPaths(target, Platform.BinaryType.All)) { if (!enabledPaths.Contains(path)) { PluginImporter importer = AssetImporter.GetAtPath(path) as PluginImporter; if (importer is PluginImporter) { Instance.binaryCompatibilitiesBeforeBuild.Add(path, importer.GetCompatibleWithPlatform(target)); importer.SetCompatibleWithPlatform(target, false); message += string.Format("\n- Disabled {0}", path); } } } RuntimeUtils.DebugLog(message); }
public void OnActiveBuildTargetChanged(BuildTarget previous, BuildTarget current) { Platform.BinaryType binaryType = EditorUserBuildSettings.development ? Platform.BinaryType.Logging : Platform.BinaryType.Release; string error; if (!Settings.Instance.CanBuildTarget(current, binaryType, out error)) { Debug.LogWarning(error); #if UNITY_2019_3_OR_NEWER if (EditorWindow.HasOpenInstances <BuildPlayerWindow>()) { GUIContent message = new GUIContent("FMOD detected issues with this platform!\nSee the Console for details."); EditorWindow.GetWindow <BuildPlayerWindow>().ShowNotification(message, 10); } #endif } }
public void OnActiveBuildTargetChanged(BuildTarget previous, BuildTarget current) { Settings.EditorSettings.CleanTemporaryFiles(); Platform.BinaryType binaryType = EditorUserBuildSettings.development ? Platform.BinaryType.Logging : Platform.BinaryType.Release; string error; if (!Settings.EditorSettings.CanBuildTarget(current, binaryType, out error)) { RuntimeUtils.DebugLogWarning(error); if (EditorWindow.HasOpenInstances <BuildPlayerWindow>()) { GUIContent message = new GUIContent("FMOD detected issues with this platform!\nSee the Console for details."); EditorWindow.GetWindow <BuildPlayerWindow>().ShowNotification(message, 10); } } }
private static void SelectBinaries(Platform platform, BuildTarget target, Platform.BinaryType binaryType) { string message = string.Format("FMOD: Selected binaries for platform {0}{1}:", target, (binaryType == Platform.BinaryType.Logging) ? " (development build)" : string.Empty); HashSet <string> enabledPaths = new HashSet <string>(); foreach (string path in platform.GetBinaryAssetPaths(target, binaryType | Platform.BinaryType.Optional)) { AssetImporter importer = AssetImporter.GetAtPath(path); if (importer != null) { (importer as PluginImporter).SetCompatibleWithPlatform(target, true); enabledPaths.Add(path); message += string.Format("\n- Enabled {0}", path); } } foreach (string path in platform.GetBinaryAssetPaths(target, Platform.BinaryType.All)) { if (!enabledPaths.Contains(path)) { AssetImporter importer = AssetImporter.GetAtPath(path); if (importer != null) { (importer as PluginImporter).SetCompatibleWithPlatform(target, false); message += string.Format("\n- Disabled {0}", path); } } } Debug.Log(message); }