Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Trying to save UI documents in Package folder breaks

Discussion in 'UI Toolkit' started by IkigaiMonkey, Jan 15, 2020.

  1. IkigaiMonkey

    IkigaiMonkey

    Joined:
    Sep 22, 2012
    Posts:
    18
    Hi.
    I'm trying to create uxml and uss inside the Package folder (I want them to be part of a new package I'm creating), but when I try to save the documents inside the UI Builder, I've this Exception:

    NullReferenceException: Object reference not set to an instance of an object
    Unity.UI.Builder.VisualTreeAssetExtensions.DeepOverwrite (UnityEngine.UIElements.VisualTreeAsset vta, UnityEngine.UIElements.VisualTreeAsset other) (at Library/PackageCache/com.unity.ui.builder@0.10.0-preview/Editor/Utilities/VisualTreeAssetExtensions/VisualTreeAssetExtensions.cs:41)
    Unity.UI.Builder.VisualTreeAssetExtensions.DeepCopy (UnityEngine.UIElements.VisualTreeAsset vta) (at Library/PackageCache/com.unity.ui.builder@0.10.0-preview/Editor/Utilities/VisualTreeAssetExtensions/VisualTreeAssetExtensions.cs:31)
    Unity.UI.Builder.BuilderDocument.SaveNewDocument (System.String uxmlPath, System.String ussPath, UnityEngine.UIElements.VisualElement documentRootElement, System.Boolean isSaveAs) (at Library/PackageCache/com.unity.ui.builder@0.10.0-preview/Editor/Builder/BuilderDocument.cs:457)


    Am I doing something really wrong or this is a known issue?

    Cheers
     
  2. IkigaiMonkey

    IkigaiMonkey

    Joined:
    Sep 22, 2012
    Posts:
    18
    I assume it should work since when you try to save them it says they have to be inside "Assets/" or "Packages/"?
     
  3. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    It should definitely not explode like that, even if it doesn't let you save. To be safe, create the UXML and USS inside your package first, and then load the UXML for editing in the UI Builder after.

    There's definitely a bug in there but I'll need more info. Can you submit a bug report using the Help > Report a bug.. menu in Unity?
     
  4. IkigaiMonkey

    IkigaiMonkey

    Joined:
    Sep 22, 2012
    Posts:
    18
    Hey Damian, thanks for the reply.
    The issue with doing that (which I tried already) is that while I can load the uxml, if I modify it and want to save it (which is the most common thing), it fails again.

    I'll submit a bug, thanks!
     
  5. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    Did you install your package "from source", or "from git", or does just live inside your project's Packages folder?
     
  6. IkigaiMonkey

    IkigaiMonkey

    Joined:
    Sep 22, 2012
    Posts:
    18
    I'm using the local referencing using "file:/" , I didn't try by using a git one (tho the package is actually in git, but for develompent I use "file:/" instead.
     
  7. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    Ya, definitely sounds like a bug.