Eonirr

Untitled

May 19th, 2025
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. [CustomPropertyDrawer(typeof(TestSprite))]
  2. public class TestSpriteDrawer : PropertyDrawer
  3. {
  4. public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
  5. {
  6. float baseHeight = EditorGUI.GetPropertyHeight(property, label, true);
  7. return baseHeight + 130f;
  8. }
  9.  
  10. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  11. {
  12. Rect spriteRect = new Rect(position.x, position.y, 128, 128);
  13.  
  14. SerializedProperty spriteProp = property.FindPropertyRelative("mySpriteTest");
  15. EditorGUI.PropertyField(spriteRect, spriteProp, GUIContent.none);
  16.  
  17. Rect restRect = new Rect(position.x, position.y + 130, position.width, position.height - 130);
  18. EditorGUI.PropertyField(restRect, property, label, true);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment