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

Question Addressables Event Viewer

Discussion in 'Localization Tools' started by o-m-g, Jan 24, 2023.

  1. o-m-g

    o-m-g

    Joined:
    Oct 27, 2022
    Posts:
    14
    I have a basic setup of a single table collection containing localized strings for en-gb and de. When I test using a scene that only contains a TextMesh Pro textfield referencing a string in the table, I notice that some assets are stuck in loading progress in the Addressables event viewer. Can someone explain why this is happening? Thank you.

    Screenshot 2023-01-24 at 11.35.58.png Screenshot 2023-01-24 at 11.37.03.png
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    Hi,
    First, make sure you are using the latest version 1.4.3 as we have several fixes to this area.
    What makes you think the operations are stuck? The event viewer is showing active operations, these operations will stay visible until the localized resources are no longer used, they will then be released and removed from the event viewer.
     
  3. o-m-g

    o-m-g

    Joined:
    Oct 27, 2022
    Posts:
    14
    Hi Karl,

    Thanks for your fast reply.

    1.4.3 isn't available in the package manager for me - I only see 1.3.2.

    The problem I see is the dull blue (resource loading) doesn't disappear when I change scenes, and I get more as additional scenes with localised strings are loaded.

    Do I have to manually release anything then changing scenes? For example if I load a scene with no localised content?

    Thanks!
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    You should be able to update by manually changing the version number in the manifest.json file in the Packages folder.
    1.4 has a lot of fixes for this area.
    Changing scenes won't get rid of everything, there will still be the initialization operation, tables that have been preloaded or used, and Locales.
    Unloading tables will occur when you change the selected language. If you want to release them sooner you can call ReleaseTable
     
  5. o-m-g

    o-m-g

    Joined:
    Oct 27, 2022
    Posts:
    14
    Thank you - I'm running 1.4.3 now and releasing the table works as described.

    Is there a way to release everything, Init ops, locales etc - for example I want to move to a performance critical scene and it contains no localisable content - so Ideally I'd like to remove the entire system from memory?
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    The system should not be using much memory if it's not doing anything.
    You would need to release the Localization settings initialization operation and maybe also the locales provider PreloadOperation.
     
  7. o-m-g

    o-m-g

    Joined:
    Oct 27, 2022
    Posts:
    14
    Thanks, ideally we'd like to unload the system completely if possible. Do you have any pointers on how to locate the locales preload op? I don't see an API for that?
     
  8. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    Its in
    LocalizationSettings.AvailableLocales as LocalesProvider
     
  9. o-m-g

    o-m-g

    Joined:
    Oct 27, 2022
    Posts:
    14
    Thank you - that helps alot.

    I'm able to release those assets now.

    What I don't understand is why these assets remain loaded(ing) They persist between scenes, is there a way for me to release them when a scene unloads?

    Specifically I mean the Selected Locale operations.

    Screenshot 2023-01-24 at 20.02.53.png
     
  10. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    No. The system is independent from scenes. Generally you don't unload the selected locale, it stays throughout the game. You can get the SelectedlocaleAsync if you need to release it.
    Do you have any scripts accessing localization? They may be causing those operations.
     
  11. o-m-g

    o-m-g

    Joined:
    Oct 27, 2022
    Posts:
    14
    The only scripts using Localisation are the supplied LocalizeStringEvent component, does that require any additional release between scenes if I disable that component the CurrentLocale operations are not started.
     
  12. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    No that should be fine. If you are using 1.4.3 then it sounds like a bug. Please file a bug report so we can look further into it.
     
  13. o-m-g

    o-m-g

    Joined:
    Oct 27, 2022
    Posts:
    14
    This behaviour is present in both 1.3 & 1.4.3, it happens in the most simple of scenes too, i.e package installed, and a scene with a single textfield (with a localizestringevent component attached). when the textfield is destroyed (scene unload for example) the addressable reference counts are not decremented. Adding additional textfields/strings and the count scale 1:1. Is the system pooling the async requests? What I don't understand is how these Addressables are every released? We have scenes where we require zero localisation, so have a dormant system with accumulated addressable is not ideal.
     
  14. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    Yes the system pools operations but they won't show on the events unless they are currently being used. We spent a lot of time during 1.4 on the operations management, we have multiple tests to ensure that every operation is released and does not leak, so it should be working. The tables and locales are the only things you should need to manually release if you don't want them to persist.
    Do you know how much memory the system is taking? It feels like you may be going down a path here that eventually doesn't give you much benefits. These operations are not big, they tend to have a handful of variables in each of them.
    Can you share an example project, with your releasing code so I can see what's missing?
     
  15. o-m-g

    o-m-g

    Joined:
    Oct 27, 2022
    Posts:
    14
    Thanks Karl and thank you for your patience on this, it is greatly appreciated.

    Yes you are correct, we may be micro optimising here, but there's also the issue of the localisation system polluting the event viewer is inactive operations, potentially making it harder for us to spot genuine issues.

    I've attached a simple project:

    Two scenes "Sample Scene" & "Next Scene"

    SampleScene has a single TMPro textfield linked to a localised string "Hello World"
    NextScene has a single TMPro textfield linked to a localised string "Next Scene"

    There is a single script "Controller" that simply moves from the initial scene to the next after 3 seconds

    Everything works fine in terms of localisation.

    However (and maybe this is just our misunderstanding of the system) the operations generated in scene "Hello World" persist into the "next scene". Our expected behaviour would be that they are released when the scene is unloaded & the TextField is destroyed.

    Like you said the overhead here is minor, but we're targeting mobile, so anything that grows overtime is a worry. if these operations are pooled, is there a way of clearing the pool manually?
     

    Attached Files:

  16. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    Ok looks like you found a bug in Addressables. GetTableEntryOperation is a custom operation, it has a ToString method to report various debug info which can change during the course of loading. It seems that the event viewer is using the ToString method as a way to identify the operations so when the output changes it treats a single operation as multiple.

    The bottom 2 operations are in fact a single operation. I think the darkened blue must indicate that the operation can not be found.
    upload_2023-1-25_13-46-36.png

    I reported the bug to the Addressables team - https://issuetracker.unity3d.com/product/unity/issues/guid/ADDR-3143. it does look like everything is working correctly but the event viewer is giving an incorrect picture. I would ignore the darkened operations for now, hopefully, we can get it fixed in the future.
    If you right-click on them you can hide them so they do not pollute the view.

    As for clearing the pools im afraid there's no public api to do this as we use internal classes in our pools. Ill add a task to add a public API for clearing the pools.
     
    Last edited: Jan 25, 2023
  17. o-m-g

    o-m-g

    Joined:
    Oct 27, 2022
    Posts:
    14
    Thanks Karl, this is awesome - thank you.

    Yeah that makes a lot of sense actually - if you set the string reference to null when destroying the scene the bright blue reference is released (as expected) and the (dull blue) remains.

    I'll stop chasing my tail now :)

    Many Thanks
     
    karl_jones likes this.