private bool CanBuildTarget(BuildTarget target, Platform.BuildType buildType, 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.GetBinaryPaths(target, buildType) .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 (buildType == Platform.BuildType.Development) { 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); }
public void OnActiveBuildTargetChanged(BuildTarget previous, BuildTarget current) { Platform.BuildType buildType = EditorUserBuildSettings.development ? Platform.BuildType.Development : Platform.BuildType.Release; string error; if (!Settings.Instance.CanBuildTarget(current, buildType, 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 } }