Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [CustomPropertyDrawer(typeof(TestSprite))]
- public class TestSpriteDrawer : PropertyDrawer
- {
- public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
- {
- float baseHeight = EditorGUI.GetPropertyHeight(property, label, true);
- return baseHeight + 130f;
- }
- public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
- {
- Rect spriteRect = new Rect(position.x, position.y, 128, 128);
- SerializedProperty spriteProp = property.FindPropertyRelative("mySpriteTest");
- EditorGUI.PropertyField(spriteRect, spriteProp, GUIContent.none);
- Rect restRect = new Rect(position.x, position.y + 130, position.width, position.height - 130);
- EditorGUI.PropertyField(restRect, property, label, true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment