Wanzyee Studio

System.Attribute to add custom item act to Shortcut to perform. More...

Inherits Attribute.

Public Member Functions

 ShortcutActAttribute (string name, int order=0, Type type=null)
 Setup the act's menu name, order, and target type. More...
 

Public Attributes

readonly string name
 The menu name, also as the act name to index the method. More...
 
readonly int order
 The menu order. More...
 
readonly Type type
 The type of the item target, on which this act can be performed. More...
 

Detailed Description

System.Attribute to add custom item act to Shortcut to perform.

Add this to a static method to add the act name to the Shortcut context and settings popup menus. The method will be fired when the specified act performed. Note, generic methods, or methods of generic types are not supported. The method should have the following signature: static void PerformAct(Object asset).

Declaring examples below:

[ShortcutAct("Log Asset")]
public static void LogAsset(Object asset){
Debug.Log(asset, asset);
}

For compatibility, a return value will be ignored if exist:

[ShortcutAct("Script/AddComponent", 7, typeof(MonoScript))]
private static Component AddComponentToSelected(Object script){
return Undo.AddComponent(Selection.activeGameObject, (script as MonoScript).GetClass());
}

Constructor & Destructor Documentation

ShortcutActAttribute ( string  name,
int  order = 0,
Type  type = null 
)

Setup the act's menu name, order, and target type.

Parameters
nameMenu name.
orderMenu order.
typeTarget type.

Member Data Documentation

readonly string name

The menu name, also as the act name to index the method.

Like the editor menu, it accepts setting "Folder/ActOne" and "Folder/ActTwo" to arrange groups.

readonly int order

The menu order.

readonly Type type

The type of the item target, on which this act can be performed.