Inline Editor Attribute

InlineAttribute 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 = ExampleHelper.GetScriptableObject<ExampleTransform>();

[Title("Foldout")]
[InlineEditor(InlineEditorObjectFieldModes.Foldout)]
public ExampleTransform Foldout = ExampleHelper.GetScriptableObject<ExampleTransform>();

[Title("Hide ObjectField")]
[InlineEditor(InlineEditorObjectFieldModes.CompletelyHidden)]
public ExampleTransform CompletelyHidden = ExampleHelper.GetScriptableObject<ExampleTransform>();

[Title("Show ObjectField if null")]
[InlineEditor(InlineEditorObjectFieldModes.Hidden)]
public ExampleTransform OnlyHiddenWhenNotNull = ExampleHelper.GetScriptableObject<ExampleTransform>();

public class ExampleTransform : ScriptableObject
{
    public Vector3 Position;
    public Quaternion Rotation;
    public Vector3 Scale = Vector3.one;
}

[InlineEditor]
public ExampleTransform InlineComponent = ExampleHelper.GetScriptableObject<ExampleTransform>();

[InlineEditor(InlineEditorModes.FullEditor)]
public Material FullInlineEditor = ExampleHelper.GetMaterial();

[InlineEditor(InlineEditorModes.GUIAndHeader)]
public Material InlineMaterial = ExampleHelper.GetMaterial();

[InlineEditor(InlineEditorModes.SmallPreview)]
public Material[] InlineMaterialList = new Material[]
{
    ExampleHelper.GetMaterial(),
    ExampleHelper.GetMaterial(),
    ExampleHelper.GetMaterial(),
};

[InlineEditor(InlineEditorModes.LargePreview)]
public Mesh InlineMeshPreview = ExampleHelper.GetMesh();

// You can also use the InlineEditor attribute directly on a class definition itself.
//[InlineEditor]
public class ExampleTransform : ScriptableObject
{
    public Vector3 Position;
    public Quaternion Rotation;
    public Vector3 Scale = Vector3.one;
}