コード例 #1
0
        /// <summary>
        /// Draw an property field with an asset preview below it.
        /// </summary>
        /// <param name="_property">Property to display and draw asset preview.</param>
        /// <param name="_label">Displayed label.</param>
        /// <param name="_foldout">The shown asset preview foldout state.</param>
        /// <param name="_previewAspect">Aspect of the displayed asset preview.</param>
        /// <returns>Returns new asset preview foldout state.</returns>
        public static bool AssetPreviewField(SerializedProperty _property, GUIContent _label, bool _foldout, float _previewAspect)
        {
            Rect _rect = EditorGUILayout.GetControlRect(true, EditorGUIUtilityEnhanced.GetAssetPreviewPropertyHeight(_property, _foldout, _previewAspect));

            return(EditorGUIEnhanced.AssetPreviewField(_rect, _property, _label, _foldout));
        }
コード例 #2
0
        // Make your own IMGUI based GUI for the property
        public override void OnGUI(Rect _position, SerializedProperty _property, GUIContent _label)
        {
            AssetPreviewAttribute _attribute = (AssetPreviewAttribute)attribute;

            _attribute.Fodlout = EditorGUIEnhanced.AssetPreviewField(_position, _property, _label, _attribute.Fodlout);
        }