My purpose is to balance the load of the accelerator by selecting an idle accelerator before importing the asset.
I have tried InitializeOnLoad, and although it can change the address of the cache server successfully, it does not take effect until the asset is imported.
The import process runs in several passes and one of those is finding all your scripts. At the point it finds your InitializeOnLoad to run it’s already in the middle import process - because that’s how it found your script. Scripts are imported and cached just like any other asset. So it’s probably already uploading assets at the point your code is run.
There are command line arguments to set the accelerator on Unity startup which would probably be where you’d need to set it to do what you want.