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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Bug (v0.4.6-preview): CreateEditor() invocation every frame in AddressableAssetGroupInspector.cs

Discussion in 'Addressables' started by Tor-Vestergaard, Oct 30, 2018.

  1. Tor-Vestergaard

    Tor-Vestergaard

    Joined:
    Mar 20, 2013
    Posts:
    180
    Hullo,

    Hope this is the right place to report bugs - couldn't really find anywhere else, but if I'm in the wrong place, just let me know :)

    I'm an Odin dev, and a little bug hunt regarding reported Odin incompatibilities with the addressables system led me down this rabbit hole. In essence, whenever an AddressableAssetGroup is inspected and Odin is the editor for any of the inspected schemas, the implementation of AddressableAssetGroupInspector will mess thing up by creating a new Editor instance every frame for every group schema it contains. This issue isn't just isolated to anything specific to Odin, but will affect a broader range of editors.

    The problematic code is on line 94 of the AddressableAssetGroupInspector.cs file in the 0.4.6-preview package: CreateEditor(schema).OnInspectorGUI();

    I haven't checked on any other versions yet, but we've had it reported from as far back as 0.4.0.

    A suggested fix (and optimization) would be to create and cache the required editors in the first Layout event when they're necessary, so you're not instantiating/resetting (disable/enable if editor caching steps in) new editors on every single GUI event or even every GUI layout>events>repaint loop, which will cause issues with any editors that rely on keeping state across several GUI events, such as Odin's editors. It's a terrible "quick-n-dirty" inspector hack that I've seen in many places before, and as always, it's causing issues for everyone involved.

    Cheers!
     
    Last edited: Oct 30, 2018
  2. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    350
    Would love to see this fixed, and I think a lot of other people might too, given that Unity has offered Odin inspector as a freebie for renewing your unity subscription early.
     
  3. Tor-Vestergaard

    Tor-Vestergaard

    Joined:
    Mar 20, 2013
    Posts:
    180
    Any update on this? It seems to have gone largely unacknowledged - should this be reported through the in-engine bug reporter somehow, instead?
     
  4. RDeluxe

    RDeluxe

    Joined:
    Sep 29, 2013
    Posts:
    115
    That's why this code should be open sourced too !
     
    RecursiveFrog likes this.
  5. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Thanks for letting us know about this. The forum is a fine place to report bugs, but it's most helpful if you do it via Unity's bug reporting mechanism. Regardless, we have this fixed in our code base now, and will have that resolved in the next update.

    -Bill
     
    RecursiveFrog likes this.
  6. Tor-Vestergaard

    Tor-Vestergaard

    Joined:
    Mar 20, 2013
    Posts:
    180
    Alright, cheers, thanks. I'll make sure to use the bug reporter if I run into anything else, then.
     
  7. zhuxianzhi

    zhuxianzhi

    Joined:
    Mar 30, 2015
    Posts:
    116
    I use
    Addressables: 0.4.8-preview
    Odin - Inspector: 2.0.13

    Still the same Error, are there any updates now?
     
  8. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    0.4.8 was just a hot-fix for a big iOS bug. 0.5.x will have the fix to this one.