Reference

This page is dedicated for explaining scripting api references.

EditorActionButtonAttribute

an attribute class that is used for defining custom editor action buttons on static methods to draw them in component or object headers.

type
parameter
description

string

id

unique per type. There can be multiple id with same value on different targetTypes

Type

targetType

Show buttons on the target type and its derived types. If a type that derives from the target type is added separately with the same ID, the button will not be shown on that type and its derived types.

string

iconPath

path to an texture under the Assets/Editor Default Resources folder e.g. "Assets/Editor Default Resource/SubFolder/example.png" only the bold part should be used.

string

tooltip

small message to show on hover

int

priority

button placement order

Use Case:

//Method can have both single parameter or array parameter. 
//Array sends all selected contexts and single sends only the first from selected.

[EditorActionButton("print", typeof(Transform), "SubFolder/example.png", 
"Print transform position", 0)]
private static void PrintTransform(Object context)
{
    Debug.Log(((Transform)context).position);
}

//---------------or---------------

[EditorActionButton("print", typeof(Transform), "SubFolder/example.png", 
"Print transform position", 0)]
private static void PrintTransform(Object[] contexts)
{
    foreach(var context in contexts)
    {
        Debug.Log(((Transform)context).position);
    }
}

EditorActionButtonValidateAttribute

Helper attribute for show/hide/disable condition management of the button

type
parameter
description

Type

targetType

Determines which type's buttons should be under validation

string

id

used to find editor action button with this id for validation

return type
description

ButtonState

tells what to do with the button after validation

Use Case:

GameObjectActionButtonAttribute

an attribute class that is used for defining custom editor action buttons on static methods to draw them in inspector header or hierarchy item

type
parameter
description

string

id

unique per placementType. There can be multiple id with same value on different placementType

GOPlacementType

placementType

Determines which area the buttons should draw on

string

iconPath

path to an texture under the Assets/Editor Default Resources folder e.g. "Assets/Editor Default Resource/SubFolder/example.png" only the bold part should be used.

string

tooltip

small message to show on hover

int

priority

button placement order

Use Case:

GameObjectActionButtonValidateAttribute

Helper attribute for show/hide/disable condition management of the button

type
parameter
description

string

id

used to find game object action button with this id for validation

GOPlacementType

placementType

Determines which area the buttons should be validated on

Use Case:

Last updated

Was this helpful?