Custom Inspectors (C#)
While Airship will generate a default inspector for AirshipBehaviour components, you may want to create a custom inspector to:
Create a more user-friendly interface for complex components
Organize and group properties
Conditionally show/hide UI based on user choices.
If you need to just categorize or add constraints to properties, you can refer to Using Component Decorators.
Currently editor scripts can only be written through the C# AirshipEditor API. Support for TypeScript-based editor scripts may come in future.
You can declare an AirshipBehaviour as per usual -
export default class ExampleComponent extends AirshipBehaviour {
public name = "Bob";
public age = 20;
public favouriteColor = Color.blue;
}
Creating a custom inspector script
Airship only supports using IMGUI for custom inspectors at this time.
Creating a custom inspector for any Airship serialized object is pretty straightforward. You will need to create a class that derives from AirshipEditor and add the AirshipEditor attribute to it. This will let Airship know what class this custom inspector represents.

AirshipEditor is similar to UnityEngine.Editor and contains Airship parallels to the unity custom editor API
It contains a
serializedObjectandtargetpropertyYou can access airship properties via
serializedObject.FindAirshipProperty("propertyName")- this will return anAirshipSerializedValuewhich you can use to check or modify the property with; similar toSerializedProperty.You can render properties using the Airship editor system using
AirshipEditorGUI.PropertyField(airshipProperty)by default, however you are not limited to it.
Example 1: Showing/Hiding properties based on user choices
There may be cases where you want to show/hide properties based on what the user has selected
The resulting inspector behaviour:



Last updated