# ContextMenuItemAttribute(string, string)

> Use this attribute to add a context menu to a field that calls a named method.

## Definition

* **Type:** Constructor
* **Namespace:** [UnityEngine](/engine/6000.5/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public ContextMenuItemAttribute(string name, string function)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the context menu item.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the function that should be called.
