question

felix avatar image
felix asked

How to load asset bundles uploaded using File Management feature of the Game Manager

Good day. I'm trying to use Asset Bundles for my Unity game while hosting them in PlayFab's CDN. I uploaded my asset bundle and manifest files by going to the Game Manager → Content → File Management → Create Folder → Upload Files to that folder.

I'm now trying to download the asset bundles in my Unity game but I'm not sure if I'm on the right track. Looking for some documentation, the closest I found to what I need would be this github entry:

https://github.com/PlayFab/PlayFabAssetBundleManager

Am I on the right track? If not, can someone please point to me the good reference to start implementing the download function for the asset bundle?

If the link above is where I should start, then I need to clarify about the bundle root. Should I use the folder that I just created or the actual file name of the asset bundle? Please take note that I used the simple BuildAssetBundles call and not the editor functions provided by the PlaFabAssetBundleManager package.

Hope someone can help me with this. Thank you very much.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

felix avatar image felix commented ·

For those who are trying to use the asset bundle build tool provided by the AssetBundleManager (i.e. Assets → Asset Bundle → Build Asset Bundle) and wondering why you're not seeing asset bundle files in the inspector, it's because it's created outside of the assets folder. You can modify the code by doing the following changes:

0 Likes 0 ·
felix avatar image felix commented ·

In Utility.cs declare:

public const string AssetPath = "Assets";

In BuildScript.cs change the value of the output path by changing the references as follow:

string bundleRootFolder = Path.Combine(Utility.AssetPath, Utility.AssetBundlesOutputPath);
string outputPath = Path.Combine(bundleRootFolder,  Utility.GetPlatformName()); 

You should now see the asset bundle files in your AssetBundles folder in your inspector.

0 Likes 0 ·

1 Answer

·
brendan avatar image
brendan answered

To start with (and to be very transparent), the PlayFab Asset Bundle Manager has not been tested with out latest SDK. That project is indeed one that our tools team built for the issue you're facing (dealing with asset bundles), but I'm afraid it's not currently supported. I'm working with the tools team to get the readme updated with some additional info, and to have additional testing done on that project, so that we can make it an officially supported tool. In the meantime, that would be a good starting place for working with assets. To use it, you would need to make sure you are uploading the bundles in the expected format - have a look at the section of the readme titled "The code". The Key specified for the package is effectively its relative path, as built by Unity. So, you can see in the code section that the baseManifest, which is what is passed to GetContentDownloadUrl is:

The BundleRoot (which you specify) + "/" + the platform name + "/" + the platform name

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

felix avatar image felix commented ·

I see. Thank you for being honest on that part. I will see how far I can go with the tools provided.

0 Likes 0 ·
felix avatar image felix commented ·

Ok. So I proceeded working on the existing package for AssetBundleManager. I aimed to load Unity sprites that I compressed in an asset bundle. I was able to figure out how to produce the asset bundles that are visible in the editor's project pane (just moved the target folder inside the Assets folder as I commented above). I uploaded the files using Playfab's Game Manager by creating a new folder inside the Root.

0 Likes 0 ·
felix avatar image felix commented ·

The name of that folder is what I set as the bundle root in the script (in my case PlayfabTestAB). I maintained the hierarchy by creating a folder named after the target platform that I set in my Unity editor. After setting up all my scripts, I get the following error:

Failed downloading bundle webgl from <my CDN url here>

Not sure if I should continue the discussion in this thread or continue somewhere else. Please let me know. Thank you.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.