Search Unity

Question [Solved] Where does the Cache Management value in Preferences come from? [also a suggestion]

Discussion in 'Package Manager' started by Thomas-Bousquet, Mar 13, 2023.

  1. Thomas-Bousquet

    Thomas-Bousquet

    Joined:
    Dec 19, 2016
    Posts:
    41
    Hi
    So I've setup a global config file in
    C:\ProgramData\Unity\config\upmconfig.toml
    as indicated in the Manual:
    Code (CSharp):
    1. cacheRoot = "C:\\ProgramData\\Unity\\cache"
    I have checked that there is no
    UPM_CACHE_ROOT
    or
    UPM_CACHE_PATH
    in the environment variables.
    I also checked that there is no .upmconfig.toml under the user profile folder.

    However, when I look at the preference, it still point to the current user local data.
    The dropdown has the 'Restore to default value' grayed out, so I'm thinking that's what it is but ... where is that default value taken from ?
    Is there an issue with my config file ? If so it'd be cool to have an error on startup.
    Am I missing something ?
    In any case, it would be great to have the pref UI states where the displayed paths comes from: a config file and its path or a key in the environment variables.

    Cheers and thanks in advance for the help.
     
  2. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    556
    Hi @Thomas-Bousquet,

    What you tried to configure is the global configuration file but that configuration value is not currently supported in that file, only in the user configuration file. That's most likely why it didn't work.

    Unity currently supports 3 sources for that configuration:
    - The default location (in which case the 'Restore to default value' is grayed out as you saw)
    - The *user* configuration file, which is what's updated via the Package Manager Preferences window (in which case both 'Restore to default value' and 'Change Location' are enabled and usable).
    - The
    UPM_CACHE_ROOT
    environment variable, in which case the UI also displays a note, "The Packages Cache location is set by environment variable UPM_CACHE_ROOT, you cannot change it." and both buttons are grayed out).

    I realize that the Unity Manual page documenting the cache location configuration does not clearly spell out that only the user configuration file can be used and that it does not work in the global configuration file.

    I hope that helps!
     
  3. Thomas-Bousquet

    Thomas-Bousquet

    Joined:
    Dec 19, 2016
    Posts:
    41
    Thanks for the answer!

    Yes, please clarify on the documentation page that this only works with user configuration - nothing state that in that paragraph.

    Also, since there is already a case in which there is a message displayed in the UI, you should consider spelling it out the other 2 cases as well - it isn't great for user to have to parse the state of a dropdown box to know where the value comes from.

    Finally, it'd be great to have the global configuration file support the cacheRoot value or a least have an error in the log on startup to say this value is not supported/unrecognized.
     
  4. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    556
    Thanks for the feedback, all very good points. I'll make sure the teams are informed.
     
    Thomas-Bousquet likes this.