private static IEnumerable <BuildTarget> GetUnityBuildTargets(SpatialBuildPlatforms actualPlatforms) { var result = new List <BuildTarget>(); if ((actualPlatforms & SpatialBuildPlatforms.Current) != 0) { actualPlatforms |= GetCurrentBuildPlatform(); } if ((actualPlatforms & SpatialBuildPlatforms.Linux) != 0) { result.Add(BuildTarget.StandaloneLinux64); } if ((actualPlatforms & SpatialBuildPlatforms.OSX) != 0) { result.Add(BuildTarget.StandaloneOSX); } if ((actualPlatforms & SpatialBuildPlatforms.Windows32) != 0) { if ((actualPlatforms & SpatialBuildPlatforms.Windows64) != 0) { throw new Exception(IncompatibleWindowsPlatformsErrorMessage); } result.Add(BuildTarget.StandaloneWindows); } else if ((actualPlatforms & SpatialBuildPlatforms.Windows64) != 0) { result.Add(BuildTarget.StandaloneWindows64); } return(result.ToArray()); }
private static string BuildPlatformToString(SpatialBuildPlatforms value) { if (value == SpatialBuildPlatforms.Current) { return($"Current ({WorkerBuilder.GetCurrentBuildPlatform()})"); } return(value.ToString()); }
private static string SelectedPlatformsToString(SpatialBuildPlatforms value) { var enumValues = Enum.GetValues(typeof(SpatialBuildPlatforms)).Cast <SpatialBuildPlatforms>().ToArray(); if (value == 0) { return("None"); } return(string.Join(", ", enumValues .Where(enumValue => (value & enumValue) != 0) .Select(BuildPlatformToString).ToArray())); }
private void ConfigureBuildPlatforms(BuildEnvironmentConfig environmentConfiguration) { using (IndentLevelScope(1)) { var buildPlatformsString = EnumFlagToString(environmentConfiguration.BuildPlatforms, BuildPlatformToString); EditorGUI.BeginChangeCheck(); var showBuildPlatforms = EditorGUILayout.Foldout(environmentConfiguration.ShowBuildPlatforms, "Build Platforms: " + buildPlatformsString); SpatialBuildPlatforms newBuildPlatforms = environmentConfiguration.BuildPlatforms; if (showBuildPlatforms) { newBuildPlatforms = EnumFlagsToggleField(environmentConfiguration.BuildPlatforms, BuildPlatformToString); } var currentAdjustedPlatforms = newBuildPlatforms; if ((currentAdjustedPlatforms & SpatialBuildPlatforms.Current) != 0) { currentAdjustedPlatforms &= ~SpatialBuildPlatforms.Current; currentAdjustedPlatforms |= WorkerBuilder.GetCurrentBuildPlatform(); } if ((currentAdjustedPlatforms & SpatialBuildPlatforms.Windows32) != 0 && (currentAdjustedPlatforms & SpatialBuildPlatforms.Windows64) != 0) { EditorGUILayout.HelpBox( "\n" + WorkerBuilder.IncompatibleWindowsPlatformsErrorMessage + "\n", MessageType.Error); } if (EditorGUI.EndChangeCheck()) { // build platforms have changed EditorUtility.SetDirty(target); Undo.RecordObject(target, "Configure build platforms for worker"); environmentConfiguration.ShowBuildPlatforms = showBuildPlatforms; environmentConfiguration.BuildPlatforms = newBuildPlatforms; } } }