Search Unity

Bug TwoPaneSplitView is missing a factory method

Discussion in 'UI Toolkit' started by Hertzole, Sep 11, 2020.

  1. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Hi

    I'm trying to use TwoPaneSplitView in my runtime UI and then when I build, it complains about TwoPaneSplitView not having a factory method. My own custom elements work fine. I'm not sure if it depends on how it was added. I added it to my UI by copying it from the UI builder uxml since I can't find any other way to use it in the UI builder.

    EDIT: It did actually matter how it was added. I checked the uxml file and it was referencing Unity.UI.Builder.TwoPaneSplitView but if I changed it to ui:TwoPaneSplitView it worked. So I guess you can disregard this post.

    Just wish there was an easier way to add it to the UI builder.
     
    Last edited: Sep 11, 2020
  2. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    For now, TwoPaneSplitView has not yet been added to UI Builder's curated library of controls. This particular control is a bit tricky because it _requires_ exactly 2 child elements when it's instantiated so you will get a lot of errors initially in the Builder until you give it to child elements.

    If you turn on Internal Mode in Unity (ie. type "internal" while you have the About window open), you'll see all controls under the UnityEngine namespace in the Builder's Library / Project tab. TwoPaneSplitView should be there as well and you can drag it over (ignoring its yelling about not enough children). Doing this should get you the "correct" TwoPaneSplitView. But I highly recommend you stick to adding TwoPaneSplitView manually in UXML for now (as you did already in your fix). Once it's there, you can resume editing the UXML using UI Builder.
     
    Hertzole likes this.