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 Does Localization cause Addressable to be initialized automatically?

Discussion in 'Localization Tools' started by nick0937, Dec 2, 2022.

  1. nick0937

    nick0937

    Joined:
    May 14, 2014
    Posts:
    10
    Hi, there!

    I have a project using both Addressable system and Localization system, Addressables uses the "Static Profile variables" way to modify the URLs it uses to load assets at runtime, but "Static Profile variables" must be set before Addressables are initialized.

    But the localization system seems to make the addressable system initialized automatically.

    My guess is that "Localization Settings > Available Locales" causes Addressable System to initialize?!

    The question is, is there any way to disable automatic initialization of the localization system when the application starts?

    I'm using Localization 1.4.2 and Unity 2020.3.42f1.

    Any advice would be greatly appreciated!
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    Yes, localization will cause Addressables to initialize. You cant stop it but you could try using an Initialization object to set your value.

    https://docs.unity3d.com/Packages/com.unity.addressables@1.19/manual/InitializeAsync.html
    https://docs.unity3d.com/Packages/c...AssetSettings.html#initialization-object-list

    Alternatively you could place a scriptable object asset in the projects player settings preloaded assets. The OnEnable will be called first before localization initialization, you could then do your initialization here.
     
    Last edited: Dec 2, 2022