Search Unity

Feedback (Case 1174068) Addressable Profiler does not work if initialisation is deferred

Discussion in 'Addressables' started by AlkisFortuneFish, Aug 3, 2019.

  1. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    973
    The Addressable Profiler has not worked for us for a while. Since I'm trying to debug something and I needed it, I had a look. The bug report provides a full repro, as well as my current fix/workaround.

    Long story short, unless the Addressables system is initialised in the first frame of entering play mode, the profiler does not work. This is because the
    EventViewerWindow
    attempts to register to the
    DiagnosticEventCollector
    callback in
    OnEnable
    and
    OnEditorPlayModeChanged
    , but the
    DiagnosticEventCollector
    object is created on initialisation of the Addressables system, unless
    DiagnosticEventCollector.RegisterEventHandler()
    is called with the create argument set to true.

    Now, DiagnosticEventCollector does not seem to do anything that would cause much of an issue if it is initialised early, so my local fix is currently:

    EventViewerWindow.cs:88
    Code (CSharp):
    1. void RegisterEventHandler(bool reg)
    2. {
    3. --- DiagnosticEventCollector.RegisterEventHandler(OnEditorPlayModeEvent, reg, false); ---
    4. +++ DiagnosticEventCollector.RegisterEventHandler(OnEditorPlayModeEvent, reg, reg); +++
    5. }
     
    danilonishimura likes this.
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Thanks for the report and the fix. much appreciated!
     
    AlkisFortuneFish likes this.
  3. MarcusKing

    MarcusKing

    Joined:
    Dec 5, 2018
    Posts:
    5
    Will this fix make it into the next release?