Search Issue Tracker

Fixed in 1.0.0-preview.8

Votes

0

Found in [Package]

1.0.0-preview.6

Issue ID

1274846

Regression

No

UI Builder deletes the content of UXML files when dragging elements which cause 'InvalidOperationException'

Package: UI Builder

-

How to reproduce:
1. Open the attached project (pbag-minimal.zip)
2. From the UI Builder Standard Library choose a 'Visual Element' Container and drag it in 'UXML_ItemInfo.uxml' on the '#unity-content-container'
3. Drag 'Visual Element' on 'ListView'
4. In the Library switch to the Project tab
5. Right-click on 'UXML_Base.uxml' and select 'open in UIBuilder' (changes have to be saved)

Expected result: the content of 'UXML_Base.uxml' didn't change
Actual result: the content of 'UXML_Base.uxml' is deleted completely and 'UXML_ItemInfo.uxml' is deleted partially

Reproducible with: 1.0.0-preview.1, 1.0.0-preview.5, 1.0.0-preview.6 (2019.4.10f1, 2020.1.5f1, 2020.2.0b3, 2021.1.0a1)
Could not test with: 2018.4.27f1 (package not compatible)

Notes:
1. Started getting errors at step 3: 'InvalidOperationException: You can't add directly to this VisualElement. Use hierarchy.Add() if you know what you're doing.'
2. Doesn't only reproduce with Visual Element but with other Containers and Controls

  1. Resolution Note (fix version 1.0.0-preview.8):

    ListView is not designed to have any element added to it as child elements. The UI Builder was incorrectly allowing this. As soon as there was a refresh, ListView would reset its contents and delete any manually added elements. In UI Builder 1.0.0-preview.8, this was addressed by not allowing the addition of child elements to any such closed elements (elements that have their contentContainer set to null).

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.