Search Unity

Prefab Override support

Discussion in 'UI Toolkit' started by vertxxyz, Mar 13, 2021.

  1. vertxxyz

    vertxxyz

    Joined:
    Oct 29, 2014
    Posts:
    109
    The right-click Apply/Revert functionality for prefab overrides seems to be limited entirely to PropertyField labels. It doesn't seem like there's any visible API to create this yourself, and the default UIToolkit fields that are not properties with labels (ie. array or class dropdowns) do not support the right-click menu.

    The blue stripe's implementation also seems unclear, with PropertyScope/Begin-EndProperty being an extremely simple way to implement this feature, is there something similar I could do just to get the stripe?

    By vaguely looking through the Unity Reference Source it appears that implementing IBindable should do it. None of my fields need this, so would something like making the root element of the PropertyDrawer a BindableElement and binding it work? It doesn't seem to, so I'd love to know what the intended workflow here is.

    It feels like this area is greatly lacking documentation and functions which are not internal.