Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
UnityManifestBundleDirectory Class Reference

Detailed Description

Use Unity's bundle manifest directly

Not recommended in production, it's not efficient. Prefer PackedManifest.

Inheritance diagram for UnityManifestBundleDirectory:
IManifestLoader IBundleManifest

Classes

class   SpecificBundleName
 

Public Member Functions

IOperation  Initialize (BundleManager manager, string absolutePath, int version, string baseUrl)
 
bool  IsReady (BundleManager manager)
 
bool  AmountToDownload (BundleManager manager, string sanitizedLabel, out uint totalSize, out uint alreadyDownloaded)
 
IEnumerator  StartBundle (BundleManager manager, string sanitizedLabel)
 
bool  TryLookupBundle (BundleManager manager, string sanitizedLabel, out string outUrl, out Hash128 outHash, out string outCrc)
 
bool  TryGetDependencies (BundleManager manager, string sanitizedLabel, out IEnumerable< string > outRequiredSanitizedLabelList)
 
string  GetStreamingAssetsName (BundleManager manager, string sanitizedLabel, string url)
 

Static Public Member Functions

static string  SanitizeBundleName (string assetBundleName, bool bundleNamesHaveHash)
 
static SpecificBundleName  RemapBundleName_WithHash (string assetBundleName, AssetBundleManifest manifest, string[] activeVariants)
 
static SpecificBundleName  RemapVariantName_NoHash (string assetBundleName, AssetBundleManifest manifest, string[] activeVariants)
 
static string  EscapeBundleName (string source)
 

Public Attributes

bool  escapeUrls = false
 
bool  bundleNamesHaveHash = true
 

Static Public Attributes

static ILogger  Logger
 

Protected Member Functions

Hash128  GetHashForAssetBundle (SpecificBundleName bundleName)
 
IEnumerator  LoadManifest (BundleManager manager, string absolutePath, int version, string baseUrl, IGetVersion response)
 

Protected Attributes

string  baseDownloadingURL
 

Properties

IBundleManifest  ActiveDirectory [get]
 
string[]  ActiveVariants [get, set]
 
- Properties inherited from IManifestLoader
IBundleManifest  ActiveDirectory [get]
 

Member Function Documentation

◆ AmountToDownload()

bool AmountToDownload ( BundleManager  manager,
string  sanitizedLabel,
out uint  totalSize,
out uint  alreadyDownloaded 
)

How much is needed to download this?

Parameters
manager
sanitizedLabel
Returns
Was bundle found?

This will be called before StartBundle!

Return only this bundle's size. Caller will handle dependencies. This does require determining specific bundle to download, and if it's cached.

Implements IBundleManifest.

◆ GetStreamingAssetsName()

string GetStreamingAssetsName ( BundleManager  manager,
string  sanitizedLabel,
string  url 
)

Figure out what name to check for in StreamingAssets data for a given URL.

In most cases this will remove the baseURL from the url this object calculated.

Parameters
sanitizedLabel
url
Returns

Implements IBundleManifest.

◆ Initialize()

IOperation Initialize ( BundleManager  manager,
string  absolutePath,
int  version,
string  baseUrl 
)

Sets the source URL to the manifest and where all remote content is expected to be found.

Can be updated during application run for a version change.

Parameters
version If cached locally and version number matches, won't hit network
absolutePath manifest path. Not necessarily from baseUrl
baseUrl prepended to all bundle requests. Ends with slash. Typically BundleManager.GetUrlPath(absolutePath).

Implements IManifestLoader.

◆ IsReady()

bool IsReady ( BundleManager  manager )

Ready for requests?

Once ready, presumed always ready.

Implements IBundleManifest.

◆ RemapBundleName_WithHash()

static SpecificBundleName RemapBundleName_WithHash ( string  assetBundleName,
AssetBundleManifest  manifest,
string[]  activeVariants 
)
static

Remaps the asset bundle name to the best fitting asset bundle.

◆ RemapVariantName_NoHash()

static SpecificBundleName RemapVariantName_NoHash ( string  assetBundleName,
AssetBundleManifest  manifest,
string[]  activeVariants 
)
static

Remaps the asset bundle name to the best fitting asset bundle variant.

◆ SanitizeBundleName()

static string SanitizeBundleName ( string  assetBundleName,
bool  bundleNamesHaveHash 
)
static

Make requested bundle names consistent

◆ StartBundle()

IEnumerator StartBundle ( BundleManager  manager,
string  sanitizedLabel 
)

Do any pre-load tasks for a bundle that might take time.

Parameters
manager
Returns

Implements IBundleManifest.

◆ TryGetDependencies()

bool TryGetDependencies ( BundleManager  manager,
string  sanitizedLabel,
out IEnumerable< string >  outRequiredSanitizedLabelList 
)

What does this bundle depend on?

Parameters
sanitizedLabel
outRequiredSanitizedLabelList
Returns
was bundle found?

Implements IBundleManifest.

◆ TryLookupBundle()

bool TryLookupBundle ( BundleManager  manager,
string  sanitizedLabel,
out string  outUrl,
out Hash128  outHash,
out string  outCrc 
)

Gather load-time info about bundle.

Parameters
sanitizedLabel
outUrl
outHash
outCrc
Returns
was bundle found?

Implements IBundleManifest.

Member Data Documentation

◆ bundleNamesHaveHash

bool bundleNamesHaveHash = true

Were the asset bundles created with the BuildAssetBundleOptions.AppendHashToAssetBundleName on?

◆ escapeUrls

bool escapeUrls = false

should we escape bundle names when making urls?

Proper naming makes this unnecessary, and doing so slows down loading.

◆ Logger

ILogger Logger
static

Assign a logging handler

Property Documentation

◆ ActiveDirectory

IBundleManifest ActiveDirectory
get

Get the current directory

Only valid after Initialize completes without error.

◆ ActiveVariants

string [] ActiveVariants
getset

The list of bundle variants we should try to load

In highest to lowest priority order. Ignored for any bundle without a variant. Changes only affect bundles loaded in the future, not already loaded ones.