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

Bug No GUI-Implemented error with Unity 2022.2 + PropertyDrawer supporting UIToolkit

Discussion in 'UI Toolkit' started by GiantGrey, May 15, 2023.

  1. GiantGrey

    GiantGrey

    Joined:
    Jul 2, 2012
    Posts:
    261
    Hello,
    so I ran into an issue which doesn't make much sense to me.
    I've made an asset which uses the new UIToolkit to draw a custom property drawer. It basically works fine, but when I install other third-party assets the inspector suddenly shows the "No GUI-Implemented" message on my property drawer, although I'm using the latest Unity 2022.2 version, which should draw the Unity default inspector with UIToolkit.
    I know that this message shows up when the Unity inspector is drawing in IMGUI mode and the property drawer doesn't make use of the IMGUI OnGUI override method and instead uses the CreatePropertyGUI method.
    But first of all, shouldn't it be the other way around? Better support the new system instead of the old IMGUI? So if a property drawer doesn't support UIToolkit it should show the No GUI-implemented message?
    Of course the best way would be if the default inspector could show both!

    This is quite an annoying issue as I have plenty of customers which are using other assets, and it looks like that having multiple assets in a project do interfer with each other when some assets uses the old IMGUI and others the new UIToolkit to draw property drawers.
     
  2. billykater

    billykater

    Joined:
    Mar 12, 2011
    Posts:
    327
    From what I have read there are two possible causes for this:
    1. Other assets overriding the default inspector (e.g. Odin) which don't support UIToolkit yet. Most likely the main cause because of Odin's popularity.
    2. Once upon a time there was a switch somewhere that flipped back to the old behaviour. I have no idea if that is still a thing.
     
  3. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    Was gonna say similar to above, most like these 'other third-party assets' are Odin Inspector, which is presently all IMGUI based and prevents UI Toolkit property drawers from working.

    Thankfully, they will likely have an update that - by some absolutely absurd magic on their part - can draw UI Toolkit property drawers inside of IMGUI (don't ask me how, but they did it), which should be releasing some time in the future.

    I remember this but I cannot for the life of me find it any more. Perhaps the the option was removed in 2021+ in the move to UI Toolkit proper?
     
  4. GiantGrey

    GiantGrey

    Joined:
    Jul 2, 2012
    Posts:
    261
    Here's an example:
    First image shows that the default inspector is rendered with the new UIToolkit. The property drawer is displayed correctly:
    propertyDrawerOK.png

    Then I install Odin Inspector for example which uses the old IMGUI to draw property drawers. And suddenly the default inspector uses IMGUI and therefore my UIToolkit property drawer won't show up.
    propertyDrawerNotOK.png
     
  5. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    Yes as we've mentioned Odin is presently all IMGUI based and prevents UI Toolkit property drawers from working.
     
  6. GiantGrey

    GiantGrey

    Joined:
    Jul 2, 2012
    Posts:
    261
    This is absurd. It should rather be the other way around, supporting the new system and have a fallback for the old IMGUI.
    Yes there's a switch in the editor project settings at the bottom: Use IMGUI Default inspector. But I checked that and it is set to false already.
     
  7. GiantGrey

    GiantGrey

    Joined:
    Jul 2, 2012
    Posts:
    261
    I see, but it's not just Odin. There're many, many, many other assets out there using IMGUI. It's rather Unity that should provide a solution here.

    It's possible to create an IMGUI container inside of UIToolkit -> That's probably what Odin will do? And Unity should do too?
     
  8. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    The reason it happens with Odin is because Odin completely inserts itself into the editor generation process to take over with it's own system (the PropertyTree) that replaces Unity's heavily limited drawer back end. Thus if Odin is present, anything that doesn't have a
    UnityEditor.Editor
    (which Odin respects and lets do the drawing) is going to be drawn with IMGUI.

    Well Odin needed to do a legendary amount of legwork to make UI toolkit work inside of IMGUI, which has otherwise been considered a fundamental limitation of IMGUI/UI Toolkit cross compatibility. I do agree, a Unity solution here would be useful, but I don't see it happening, unless they decide to incorporate whatever solution the Odin devs figured out.

    You're likely going to have to do what most package devs are doing and just provide a fall-back drawer.
     
  9. GiantGrey

    GiantGrey

    Joined:
    Jul 2, 2012
    Posts:
    261
    I see, well thanks for the insights here with Odin. I don't use it myself so I've no experience in what they're really doing with the Unity editor. It now makes sense that everything is being drawn with IMGUI.
    While I really don't like this solution I'll see if I can provide a IMGUI fallback drawer then....
     
  10. billykater

    billykater

    Joined:
    Mar 12, 2011
    Posts:
    327
    The basic problem why so many assets break the the default inspector (which supports both imgui and uitoolkit just fine) is that for a long time the only way to override specific editor behaviours and appearances was to do a [CustomEditor(typeof(Object))], use DrawDefaultInspector and then hook into whatever functionality you wanted which causes a lot of headaches as none of these work with UIToolkit by default.
     
  11. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    Hopefully in the near future it won't be required for Odin. They have an experimental release you can ask for on their Discord, though I don't know when the functionality will become public.

    Yeah this ultimately comes down to how limited Unity's serialized object/property and property drawer system is. There's little to no modularity and I don't believe property drawers within property drawers are a thing yet either, are they?

    You'd think in the move to UI toolkit, they would've also considered updating this back-end to be a little more modular like Odin's systems. As a heavy Odin user, whenever I have to jump back into normal Unity land I absolutely hate every bit of it.
     
    bjarkeck likes this.
  12. bjarkeck

    bjarkeck

    Joined:
    Oct 26, 2014
    Posts:
    301
    The new preview build of Odin that supports drawing UI Toolkit / Visual Elements is out on our website, as of right now! :)

    https://odininspector.com/previews
     
  13. GiantGrey

    GiantGrey

    Joined:
    Jul 2, 2012
    Posts:
    261
    Awesome, that's some good news! :)
     
    bjarkeck likes this.