IRenderPipelineGraphicsSettingsContextMenu2_1
интерфейс в UnityEditor.Rendering
Интерфейсы приспособлений:IRenderPipelineGraphicsSettingsContextMenu2
Описание
Интерфейс для изменения контекстного меню IRenderPipelineGraphicsSettings в Inspector.
С помощью этого интерфейса в контекстное меню добавляют собственные команды для IRenderPipelineGraphicsSettings. Тип транспортного средства IRenderPipelineGraphicsSettings Меню, добавленное здесь, появится в соответствующем контекстном меню в **Edit** > **Project Settings** > **Graphics**.
using UnityEditor; using UnityEditor.Rendering; using UnityEngine.UIElements;
struct DummyAMenu : IRenderPipelineGraphicsSettingsContextMenu2<DummyA> { // The lower the priority, the higher the added command appears in the menu public int priority => 0;
public void PopulateContextMenu(DummyA setting, SerializedProperty _, ref GenericMenu menu) { // Add specific commands that appear when you select the contextual menu button // of a DummyA in **Edit** > **Project Settings** > **Graphics**. It will not appear for other types. 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()); } }
Открытые методы
| Метод | Описание |
|---|---|
| PopulateContextMenu | Заполнить контекстное меню методами, предназначенными для вашего IRenderPipelineGraphicsSettings. |