Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ContextMenuItemAttribute

Namespace: UnityEngine

/

Inherits from: PropertyAttribute

Description

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

@ContextMenuItem ("Reset", "ResetBiography")
@Multiline (8)
var playerBiography : string = "";

function ResetBiography () { playerBiography = ""; }

no example available in C#
no example available in Boo

Variables

functionThe name of the function that should be called.
nameThe name of the context menu item.

Constructors

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

Inherited members

Variables

orderOptional field to specify the order that multiple DecorationDrawers should be drawn in.