Eonirr

Untitled

May 19th, 2025
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 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. return 140f;
  7. }
  8.  
  9. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  10. {
  11. var spriteProp = property.FindPropertyRelative("mySpriteTest");
  12.  
  13. EditorGUI.LabelField(new Rect(position.x, position.y, position.width, 16), "Sprite");
  14.  
  15. Rect objectFieldRect = new Rect(position.x, position.y + 20, 128, 128);
  16.  
  17. EditorGUI.PropertyField(objectFieldRect, spriteProp, GUIContent.none);
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment