IRenderPipelineGraphicsSettingsContextMenu2
интерфейс в UnityEditor.Rendering
Описание
Интерфейс для изменения контекстного меню всех IRenderPipelineGraphicsSettings в Inspector.
С помощью этого интерфейса в контекстное меню добавляют собственные команды для всех IRenderPipelineGraphicsSettings. Меню, добавленное здесь, появится в каждом контекстном меню в **Edit** > **Project Settings** > **Graphics**.
using UnityEditor; using UnityEditor.Rendering; using UnityEngine.UIElements;
struct DummyMenuForAll : IRenderPipelineGraphicsSettingsContextMenu2 { // The lower the priority, the higher the added command appears in the menu public int priority => 0; public void PopulateContextMenu(IRenderPipelineGraphicsSettings setting, SerializedProperty _, ref GenericMenu menu) { // Add specific commands that appear when you select the contextual menu button // of all IRenderPipelineGraphicsSettings in Edit > Project Settings > Graphics. menu.AddItem("Log type", false, () => Debug.Log(settings.GetType())); // As modifications are not recommended at runtime, check // EditorApplication.isPlaying before modifying any data. if (EditorApplication.isPlaying) menu.AddDisabledItem("Custom Reset", false); else menu.AddItem("Custom Reset", false, () =>settings.Reset()); } }
Свойства
| Свойство | Описание |
|---|---|
| priority | Приоритет для сортировки добавленных команд в контекстном меню среди других команд. |
Открытые методы
| Метод | Описание |
|---|---|
| PopulateContextMenu | Заполнить контекстное меню методами для всех IRenderPipelineGraphicsSettings. |