Displaying properties of other components
// componentReference here would be any reference to an AirshipBehaviour
var componentProperty = serializedObject.FindAirshipProperty("componentReference");
if (componentProperty.objectReferenceValue is AirshipComponent component) {
// this is similar to serializedObject, but pointing at a different component
var componentSerializedObject = new AirshipSerializedObject(component);
// Then you can use componentSerializedObject as you would with serializedObject
// ApplyModifiedProperties *must* be called otherwise the properties will not change.
componentSerializedObject.ApplyModifiedProperties();
}var componentProperty = serializedObject.FindAirshipProperty("componentReference");
if (componentProperty.objectReferenceValue is AirshipComponent component) {
// garb the custom editor and render it
var componentEditor = AirshipCustomEditors.GetEditor(component);
componentEditor.OnInspectorGUI();
// Apply any modified properties from the above call
componentEditor.serializedObject.ApplyModifiedProperties();
}
Last updated