Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Draw PropertDrawer for type from inside PropertyDrawer for Attribute

Discussion in 'Editor & General Support' started by Andrew-Carvalho, Jul 8, 2020.

  1. Andrew-Carvalho

    Andrew-Carvalho

    Joined:
    Apr 22, 2013
    Posts:
    42
    I'm currently trying to implement a PropertyDrawer for a custom attribute that will add an additional element to the inspector above a property which may have it's own custom PropertyDrawer for it's type.

    The attribute's PropertyDrawer takes priority over the type's PropertyDrawer, as expected.

    What I'd like to do is draw the additional element that the attribute provides and draw type's preferred (custom of default) property drawer. Is there a provided way to get the drawer for a SerializedProperty's type that I can then invoke?

    A DecoratorDrawer is not possible in this particular case as the element being added had logic specific to field it is declared above.

    I think the above details are clear and are at the heart of the problem but if more context is needed, I can add ti by request.