Search Unity

Bug Change dynamic variable of LocalLoadPath in game.

Discussion in 'Addressables' started by MaurizioCarlottaPetoons, Mar 14, 2023.

  1. MaurizioCarlottaPetoons

    MaurizioCarlottaPetoons

    Joined:
    Jul 9, 2021
    Posts:
    32
    Hi, I have an asset group which has a dinamic-variable as a LocalLoadPath, {MyVar}
    Once in game, throught scripting, I have tried to update the variable without any succes.
    I have also tried to Clear runtime propierties and Set my propierty.
    Code (CSharp):
    1. AddressablesRuntimeProperties.ClearCachedPropertyValues();
    2. AddressablesRuntimeProperties.SetPropertyValue("MyAssemblies.AddressablesRuntimePath", bundlesPath);
    After I have set the propierty, I use AddressablesRuntimeProperties.EvaluateProperty again to check if the value changed, and it changed.
    However when I try to load an asset the next error is thrown.
    Code (CSharp):
    1. Unable to open archive file: MyPath/StreamingAssets/aa/252736532120791daf08bd1976a28f00.bundle
    Do I have to re initialize the system, update the catalog, load it again in order to take effect or something else?
    Or maybe the system can find the .bundles in there?
    Thank you.
     
  2. MaurizioCarlottaPetoons

    MaurizioCarlottaPetoons

    Joined:
    Jul 9, 2021
    Posts:
    32
    Update: As we found in the Addressables documentation: https://www.google.com/url?sa=j&url...&usg=RltGnNp9k9lkifWr0nAjFamd-E0.&source=chat We can't change the variable once Addressable system is initialized even with AddressablesRuntimeProperties it seems. We will try to detect bundles with the Addressables.InternalIdTransformFunc and modify the path with the new path, using LoadPath as a key.
    For our project initialize all systems before Addressables and Localization would be a major change, but this would be another option to fix it I presume.
    It bothers me a little that even with AddressablesRuntimeProperties.SetPropertyValue() I can't change the value of that static variable cached.