[AddComponentMenu( "Examples/Attribute Example" )]
public class AttributesExample : MonoBehaviour
{
[ContextMenuItem( "My Field Action", "MyFieldContextAction" )]
public string MyString;
private void MyFieldContextAction()
{
[...]
}
[ContextMenu( "My Action" )]
private void MyContextMenuAction()
{
[...]
}
}
The result of the [AddComponentMenu] attribute
The result of the [ContextMenuItem] attribute
The result of the [ContextMenu] attribute
[AddComponentMenu( "Examples/Attribute Example" )]
public class AttributesExample : MonoBehaviour
The AddComponentMenu attribute allows you to place your component anywhere in the Component menu instead of the Component->Scripts menu.
[ContextMenuItem( "My Field Action", "MyFieldContextAction" )]
public string MyString;
private void MyFieldContextAction()
{
[...]
}
The ContextMenuItem attribute allows you to define functions that can be added to the context menu of a field. These functions will be executed upon selection.
[ContextMenu( "My Action" )]
private void MyContextMenuAction()
{
[...]
}
The ContextMenu attribute allows you to define functions that can be added to the context menu of the component.