connordog12
connordog12

Reputation: 38

Custom Editor - How to add option to the settings list on a component

Is it possible to add an option to the settings list when you click on the settings icon on a component in the inspector?

Image of settings drop down in the inspector

Upvotes: 0

Views: 43

Answers (1)

derHugo
derHugo

Reputation: 90659

You don'T need a CustomEditor for this.

Simply use the [ContextMenu] attribute like

[ContextMenu("Example")]
private void SomeMethodWithoutParameters()
{
    // ...
}

enter image description here


If you are rather talking about adding an entry to an existing internal component you can use a generic [MenuItem] instead starting with CONTEXT/<ComponentName> like

[MenuItem ("CONTEXT/Transform/Example")]
static void Example(MenuCommand command) 
{
    Transform transform = (Transform)command.context;

    // do something
}

script has to be placed in a folder called Editor

enter image description here

Upvotes: 1

Related Questions