/// <summary> Draws info box of the provided scene </summary> private void DrawSceneInfoGUI(Rect position, BuildUtils.BuildScene buildScene, int sceneControlID) { var disabled = BuildUtils.IsDisabled(); var disabledWarning = disabled ? "\n\nWARNING: Build Settings is not checked out and so cannot be modified." : ""; GetBuildGuiContent(buildScene, out var icon, out var label); // Left status label using (DisabledScope(disabled)) { var labelRect = DrawUtils.GetLabelRect(position); var iconRect = labelRect; iconRect.width = icon.image.width + spacing; labelRect.width -= iconRect.width; labelRect.x += iconRect.width; EditorGUI.PrefixLabel(iconRect, sceneControlID, icon); EditorGUI.PrefixLabel(labelRect, sceneControlID, label); } // Right context buttons var buttonRect = DrawUtils.GetFieldRect(position); buttonRect.width = (buttonRect.width) / 3; var tooltipMsg = ""; using (DisabledScope(disabled)) { // NOT in build settings if (buildScene.buildIndex == -1) { buttonRect.width *= 2; var addIndex = EditorBuildSettings.scenes.Length; tooltipMsg = "Add this scene to build settings. It will be appended to the end of the build scenes as buildIndex: " + addIndex + "." + disabledWarning; if (DrawUtils.ButtonHelper(buttonRect, "Add...", "Add (buildIndex " + addIndex + ")", EditorStyles.miniButtonLeft, tooltipMsg)) { BuildUtils.AddBuildScene(buildScene); } buttonRect.width /= 2; buttonRect.x += buttonRect.width; } // In build settings else { var isEnabled = buildScene.scene.enabled; var stateString = isEnabled ? "Disable" : "Enable"; tooltipMsg = stateString + " this scene in build settings.\n" + (isEnabled ? "It will no longer be included in builds" : "It will be included in builds") + "." + disabledWarning; if (DrawUtils.ButtonHelper(buttonRect, stateString, stateString + " In Build", EditorStyles.miniButtonLeft, tooltipMsg)) { BuildUtils.SetBuildSceneState(buildScene, !isEnabled); } buttonRect.x += buttonRect.width; tooltipMsg = "Completely remove this scene from build settings.\nYou will need to add it again for it to be included in builds!" + disabledWarning; if (DrawUtils.ButtonHelper(buttonRect, "Remove...", "Remove from Build", EditorStyles.miniButtonMid, tooltipMsg)) { BuildUtils.RemoveBuildScene(buildScene); } } } buttonRect.x += buttonRect.width; tooltipMsg = "Open the 'Build Settings' Window for managing scenes." + disabledWarning; if (DrawUtils.ButtonHelper(buttonRect, "Settings", "Build Settings", EditorStyles.miniButtonRight, tooltipMsg)) { BuildUtils.OpenBuildSettings(); } }