Preview Field Attribute

Draws a square ObjectField which renders a preview for UnityEngine.Object types. This object field also adds support for drag and drop, dragging an object to another square object field, swaps the values. If you hold down control while letting go it will replace the value, And you can control + click the object field to quickly delete the value it holds.

[PreviewField]
public Object RegularPreviewField;

[VerticalGroup("row1/left")]
public string A, B, C;

[HideLabel]
[PreviewField(50, ObjectFieldAlignment.Right)]
[HorizontalGroup("row1", 50), VerticalGroup("row1/right")]
public Object D;

[HideLabel]
[PreviewField(50, ObjectFieldAlignment.Left)]
[HorizontalGroup("row2", 50), VerticalGroup("row2/left")]
public Object E;

[VerticalGroup("row2/right"), LabelWidth(-54)]
public string F, G, H;

[PreviewField("preview", FilterMode.Bilinear)]
public Object I;

private Texture preview;

[OnInspectorInit]
private void CreateData()
{
    RegularPreviewField = ExampleHelper.GetTexture();
    D = ExampleHelper.GetTexture();
    E = ExampleHelper.GetTexture();
    I = ExampleHelper.GetMesh();
    preview = ExampleHelper.GetTexture();
}

[InfoBox(
    "These object fields can also be selectively enabled and customized globally " +
    "from the Odin preferences window.\n\n" +
    " - Hold Ctrl + Click = Delete Instance\n" +
    " - Drag and drop = Move / Swap.\n" +
    " - Ctrl + Drag = Replace.\n" +
    " - Ctrl + drag and drop = Move and override.")]
[PropertyOrder(-1)]
[Button(ButtonSizes.Large)]
private void ConfigureGlobalPreviewFieldSettings()
{
    Sirenix.OdinInspector.Editor.GeneralDrawerConfig.Instance.OpenInEditor();
}