In line Attribute is used on any property or field with a type that inherits from UnityEngine.Object. This includes components and assets etc.
[Title("Boxed / Default")]
[InlineEditor(InlineEditorObjectFieldModes.Boxed)]
public ExampleTransform Boxed;
[Title("Foldout")]
[InlineEditor(InlineEditorObjectFieldModes.Foldout)]
public ExampleTransform Foldout;
[Title("Hide ObjectField")]
[InlineEditor(InlineEditorObjectFieldModes.CompletelyHidden)]
public ExampleTransform CompletelyHidden;
[Title("Show ObjectField if null")]
[InlineEditor(InlineEditorObjectFieldModes.Hidden)]
public ExampleTransform OnlyHiddenWhenNotNull;
[OnInspectorInit]
private void CreateData()
{
Boxed = ExampleHelper.GetScriptableObject<ExampleTransform>("Boxed");
Foldout = ExampleHelper.GetScriptableObject<ExampleTransform>("Foldout");
CompletelyHidden = ExampleHelper.GetScriptableObject<ExampleTransform>("Completely Hidden");
OnlyHiddenWhenNotNull = ExampleHelper.GetScriptableObject<ExampleTransform>("Only Hidden When Not Null");
}
[OnInspectorDispose]
private void CleanupData()
{
if (Boxed != null) Object.DestroyImmediate(Boxed);
if (Foldout != null) Object.DestroyImmediate(Foldout);
if (CompletelyHidden != null) Object.DestroyImmediate(CompletelyHidden);
if (OnlyHiddenWhenNotNull != null) Object.DestroyImmediate(OnlyHiddenWhenNotNull);
}