private static void DrawPreview(SerializedProperty property, ShowAssetPreviewAttribute attribute) { Texture2D preview; if (property.propertyType == SerializedPropertyType.ObjectReference && property.objectReferenceValue != null && (preview = AssetPreview.GetAssetPreview(property.objectReferenceValue)) != null) { var(width, height) = GetClampedWidthAndHeight(preview.width, preview.height, attribute.Size); var align = attribute.Align; GUILayout.BeginVertical(GUILayout.Height(height)); MightyGUIUtilities.BeginDrawAlign(align); GUILayout.Label(preview, GUILayout.Width(width), GUILayout.Height(height)); MightyGUIUtilities.EndDrawAlign(align); GUILayout.EndVertical(); } else { MightyGUIUtilities.DrawHelpBox($"{property.name} doesn't have an asset preview"); } }
protected override void EndDraw(BaseMightyMember mightyMember, BaseAlignAttribute attribute) => MightyGUIUtilities.EndDrawAlign(attribute.Align);