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 {
}
Scripts menu, now it's in Transform :)Customizing the Icon
This method is deprecated, you can now customize the icon by going to the TypeScript asset file, and in the inspector changing the Icon field.
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
}
Last updated