Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Prefab overrides diff UI doesn't work with UI Toolkit

Discussion in 'UI Toolkit' started by Alex-Chouls, May 2, 2022.

  1. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    Using the bind-custom-data-type example, if I make a prefab and modify the instance, the overrides dropdown in the Inspector shows this when I select the modified instance:

    upload_2022-5-2_11-42-48.png

    I'm using Unity 2022.1.b16.

    Does this work in another version of Unity? I assume the plan is to support this and backport the fix? It seems like a big problem for people making editors with UI Toolkit.

    EDIT: To be clear the editor works in the inspector, and shows the blue prefab override indicator:
    upload_2022-5-2_11-54-40.png

    But there's no place to right-click to apply/revert changes, so I went looking in Overrides and found the No GUI Implemented problem.
     
    Last edited: May 2, 2022
  2. griendeau_unity

    griendeau_unity

    Unity Technologies

    Joined:
    Aug 25, 2020
    Posts:
    247
    It looks like the override popup is using IMGUI whereas the inspector is using UI Toolkit in this case. The custom property drawer in the documentation is only implementing the UI Toolkit entry point. It would need to also implement the IMGUI entry point to work in both places. I asked the team when the override preview will be converted to UITK as well, so at least it is consistent with the inspector. In the meantime, I'm afraid we need to implement both UITK and IMGUI entry points (also always a good practice during the transition, because users can always change that setting in the Project Settings).
     
  3. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    Where is the Project Setting? Is there a version of Unity that you anticipate being able to ship UI Toolkit only editor tools? I really, really, do not want to develop and maintain 2 completely different code bases for editors, property drawers etc.
     
  4. griendeau_unity

    griendeau_unity

    Unity Technologies

    Joined:
    Aug 25, 2020
    Posts:
    247
    In 2022.2, it is under Edit -> Project Settings -> Editor -> Use IMGUI Default Inspector.

    The override preview should be using UI Toolkit if the inspector is in UI Toolkit. This is something I brought to the team and that we'll fix. We don't want users to have to maintain 2 code bases. The idea is that UITK would be the target, but yeah, nothing prevents users from switching back to using IMGUI even if some inspector won't be supported anymore with it. It will most likely take years to do the complete switch.

    As for the issue with the prefab context options not showing, the team is currently looking at the sample. It seems it is not using the binding system in a way that could yield the correct right-click menu. We should get back to you soon with a solution :)
     
  5. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    Thanks! Is the Project Setting a fallback, in case of bugs with UI Toolkit inspectors? What is the anticipated use case for it?
     
  6. griendeau_unity

    griendeau_unity

    Unity Technologies

    Joined:
    Aug 25, 2020
    Posts:
    247
    I think this is the main purpose for that setting yes. Having UITK as the default inspector comes with its challenges, we need to make sure we're not blocking anyone.