Nenhuma descrição
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

DebugDisplaySettingsCommon.cs 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. namespace UnityEngine.Rendering.Universal
  2. {
  3. class DebugDisplaySettingsCommon : IDebugDisplaySettingsData
  4. {
  5. [DisplayInfo(name = "Frequently Used", order = -1)]
  6. private class SettingsPanel : DebugDisplaySettingsPanel
  7. {
  8. const string k_GoToSectionString = "Go to Section...";
  9. public override DebugUI.Flags Flags => DebugUI.Flags.FrequentlyUsed;
  10. public SettingsPanel()
  11. {
  12. AddWidget(new DebugUI.RuntimeDebugShadersMessageBox());
  13. foreach (var widget in DebugManager.instance.GetItems(DebugUI.Flags.FrequentlyUsed))
  14. {
  15. if (widget is DebugUI.Foldout foldout)
  16. {
  17. if (foldout.contextMenuItems == null)
  18. foldout.contextMenuItems = new();
  19. foldout.contextMenuItems.Add(new DebugUI.Foldout.ContextMenuItem
  20. {
  21. displayName = k_GoToSectionString,
  22. action = () =>
  23. {
  24. var debugManger = DebugManager.instance;
  25. var panelIndex = debugManger.PanelIndex(foldout.panel.displayName);
  26. if (panelIndex >= 0)
  27. DebugManager.instance.RequestEditorWindowPanelIndex(panelIndex);
  28. }
  29. });
  30. }
  31. AddWidget(widget);
  32. }
  33. }
  34. }
  35. #region IDebugDisplaySettingsData
  36. // All common settings are owned by another panel, so they are treated as inactive here.
  37. /// <inheritdoc/>
  38. public bool AreAnySettingsActive => false;
  39. /// <inheritdoc/>
  40. public IDebugDisplaySettingsPanelDisposable CreatePanel()
  41. {
  42. return new SettingsPanel();
  43. }
  44. #endregion
  45. }
  46. }