private void DrawRowCell(UnityEngine.Rect rect, Column column, SceneReferenceItem item, RowGUIArgs args) { if (null == item) { return; } CenterRectUsingSingleLineHeight(ref rect); switch (column) { case Column.Icon: { GUI.DrawTexture(rect, Icons.Scene, ScaleMode.ScaleToFit); break; } case Column.Scene: { DefaultGUI.Label(rect, item.ScenePath, args.selected, args.focused); break; } case Column.StartupToggle: { var toggleRect = rect; int toggleWidth = 20; toggleRect.x += rect.width * 0.5f - toggleWidth * 0.5f; bool toggleVal = EditorGUI.Toggle(toggleRect, item.IsStartup); if (toggleVal != item.IsStartup) { item.IsStartup = toggleVal; var project = Application.AuthoringProject; var sceneReference = new SceneReference { SceneGuid = item.SceneGuid }; if (toggleVal) { project.AddStartupScene(sceneReference); } else { project.RemoveStartupScene(sceneReference); } Repaint(); } break; } } }
private void ShowSceneReferenceContextMenu(SceneReferenceItem item) { if (item.SceneGuid == SceneReference.Null.SceneGuid) { return; } var project = Application.AuthoringProject; var menu = new GenericMenu(); menu.AddItem(new GUIContent($"Remove Scene from {project.Name}"), false, () => { project.RemoveScene(new SceneReference { SceneGuid = item.SceneGuid }); Invalidate(); }); menu.ShowAsContext(); }