Using Component Decorators

Just like with MonoBehaviour in Unity, with our AirshipBehaviour we can customize a few things

Customizing the component menu path

In regular Unity, there is the AddComponentMenu attribute, in Airship it's the AirshipComponentMenu decorator.

This is useful for organization purposes.

@AirshipComponentMenu("Transform/Follow Transform")
export default class FollowTransform extends AirshipBehaviour {
}
Instead of being in the Scripts menu, now it's in Transform :)

Customizing the Icon

By default an AirshipComponent has the AirshipScript icon - however this can be changed as like with MonoBehaviour scripts

This is done through the AirshipComponentIcon decorator. The path should point to a texture in your project.

@AirshipComponentMenu("Voyager/Voyager Health")
@AirshipComponentIcon("Assets/Editor/Icons/Health.png")
export default class VoyagerHealthComponent extends AirshipBehaviour {
    // ... code here
}
Note the Heart icon, also the custom title from the component menu

Last updated