Search Unity

Feature Request Is persistent data on its way for non-experimental UIElements namespace ?

Discussion in 'UI Toolkit' started by aybeone, Dec 31, 2018.

  1. aybeone

    aybeone

    Joined:
    May 24, 2015
    Posts:
    107
    As I was implementing a custom control, I found out that at assembly reload everything is lost.

    To much of my surprise it's also the case for say, ObjectField, you assign a value but at reload it's lost even though you can see that BaseField<TValueType>.m_Value has [SerializeField] attribute.

    As https://docs.unity3d.com/2019.1/Documentation/Manual/UIE-ViewData.html is useless since you don't recommend the experimental namespace, the only option left is to wait for this feature to be added.

    Is this feature going to be ported from https://docs.unity3d.com/2019.1/Doc...ce/Experimental.UIElements.VisualElement.html to https://docs.unity3d.com/2019.1/Documentation/ScriptReference/UIElements.VisualElement.html ?
     
  2. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    We didn't so much remove this feature from UIE when we came out of Experimental, as we just made it internal. It was not mature enough to make public yet. All the APIs are still there just marked internal. This does mean that until we refresh this feature (for which I don't have a time estimate right now), you cannot add view data persistence support to your custom controls.

    That said, can you elaborate a bit on what exactly you want to persist? View data persistence is NOT meant to serve as a data mode for your fields. It is only for view-only data that you would never commit to version control, for example. Fields, in general, should be backed by a proper, serializable, asset that is separate from the UI.
     
  3. aybeone

    aybeone

    Joined:
    May 24, 2015
    Posts:
    107
    Well that's embarassing, since I've posted this message I solved it by using the solution you've laid out in your paragraph !

    I'd say that I didn't really understand how things were supposed to be wired back then :D
     
    uDamian likes this.