Adding Inspector Properties

Adding properties to your component

Any public marked property that is a valid serializable type in Unity will show up in the inspector for an AirshipBehaviour component

export default class ExampleAirshipBehaviour extends AirshipBehaviour {
	public exampleString = "Hello, World!";
	public exampleBoolean = true;
	public exampleNumber = 10;
}
Woo, properties!

If you do not want your properties exposed, you can just specify them as private or protected. You can also use the @NonSerializable attribute decorator (and use @SerializeField to show private/protected fields to the inspector!)

Adding references to Unity and Airship components

You can add references to Unity Objects in the same way as values. If you might not attach a reference in the inspector you should define it as optional with a ?

References to unity objects - nice!

when referencing an object for Instantiation you must use a Game Object reference. You are not able to directly reference a component until it is instantiated in the scene.

Adding AirshipBehaviour reference properties

Just like our Unity Object references, we can also add references to other AirshipBehaviour components. Any defined class that extends AirshipBehaviour can be used as a reference.

References to another AirshipBehaviour!

Organizing your properties

You can use attributes to stylize our inspector properties using decorators:

JSDoc Tooltips

In Airship we support implicit JSDoc tooltips - which are generated by JSDoc comments:

Not only does this have the benefit of being documented in your editor:

The JSDoc tooltip in the editor

But Airship will also generate a tooltip in-editor with the same formatting:

The tooltip generated in the editor

Examples of formatting in the tooltips:

Formatted tooltips, just like in the code editor!

Last updated