I want to assign a URL for Addressables to fetch assets during runtime and point it to my Amazon S3 server, but I don’t know which option (or neither) to take.
OPTION 1
- Generate all bundles including catalog json & hash file using Unity Cloud and upload them to my S3 bucket.
- Build the app with my Addressables profile’s LoadPath set to a static variable {AB.AssetBundleURL.RemotePath} (Namespace.Class.Method)
- Call my API to get the path of my S3 bucket where my asset bundles live and assign it to the static variable. ex. https://bucketname.s3-ap-northeast-1.amazonaws.com/ver1/iOS
- Initialize Addressables.
OPTION 2
- Generate all bundles including catalog json & hash file using Unity Cloud and upload them to my S3 bucket.
- Call my API to get the path of my S3 bucket where my asset bundles live and assign it in the TransformInternalId callback.
Addressables.InternalIdTransformFunc = (location) => {
//Implement a method that gets the base url for a given location
string baseUrl = GetBaseURL(location);
//Get the url you want to use to point to your current server
string currentUrlToUse = GetCurrentURL();
return location.InternalId.Replace(baseUrl, currentUrlToUse);
};
- Finally initialize Addressables.
Which one is seen as better and why? And will bundles downloaded this way be cached automatically so that a user won’t have to be online after having downloaded the bundles? I feel like I might be missing something