Editor Message
Introduction
The editor message feature displays reminders, hints, and alerts about using the Axis framework. These alerts provide specific instructions or warnings, guiding developers on how to properly set up or use a component. Additionally, information messages highlight the expected behaviors from the current setup.
Code
Commonly named as editor_message
string property of some component classes, like in this snippet:
[AxisEditorMessage]
[SerializeField]
string editor_message = string.Empty;
Variable name can be customized, and placed at any position which will also change the place it will be rendered on the inspector. For checking conditions and updating the message shown the method EditorMessageUpdate() must be present.
private void EditorMessageUpdate()
{
editor_message = string.Empty; //Clear message for hiding it
if (!ReferenceEquals(gameObject.GetComponentInParent(typeof(ObjActionTarget)),null))
editor_message = "info:This Mark will be rendered on every available target of this ObjAction (" + gameObject.GetComponentInParent(typeof(ObjActionTarget)).name + ".";
else if (!ReferenceEquals(gameObject.GetComponentInParent(Config.navobject_type), null))
editor_message = "info:This Mark will be rendered on this NavObject (" + gameObject.GetComponentInParent(Config.navobject_type).name + ".";
else
editor_message = "error:This Mark must be added to a NavObject or ObjAction with targets.";
}
When message variable value starts with some prefixes it will display an icon, like 'error:', 'info:', 'warn:'. If none of these prefixes are used no icon is shown. In the inspector it looks something like this: