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

Use Unity's bundle manifest directly More...

Inheritance diagram for UnityManifestBundleDirectory:
IBundleDirectoryLoader IBundleDirectory

Classes

class   SpecificBundleName
  A wrapper type for a bundle name that's been looked up via RemapBundleName More...
 

Public Member Functions

AssetBundleLoadOperation  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. More...
 
bool  IsReady (BundleManager manager)
  Ready for requests? More...
 
bool  AmountToDownload (BundleManager manager, string sanitizedLabel, out uint totalSize, out uint alreadyDownloaded)
  How much is needed to download this? More...
 
IEnumerator  StartBundle (BundleManager manager, string sanitizedLabel)
  Do any pre-load tasks for a bundle that might take time. More...
 
bool  TryLookupBundle (BundleManager manager, string sanitizedLabel, out string outUrl, out Hash128 outHash, out string outCrc)
  Gather load-time info about bundle. More...
 
bool  TryGetDependencies (BundleManager manager, string sanitizedLabel, out IEnumerable< string > outRequiredSanitizedLabelList)
  What does this bundle depend on? More...
 
string  GetStreamingAssetsName (BundleManager manager, string sanitizedLabel, string url)
  Figure out what name to check for in StreamingAssets data for a given URL. More...
 

Static Public Member Functions

static string  SanitizeBundleName (string assetBundleName, bool bundleNamesHaveHash)
  Make requested bundle names consistent More...
 
static SpecificBundleName  RemapBundleName_WithHash (string assetBundleName, AssetBundleManifest manifest, string[] activeVariants)
  Remaps the asset bundle name to the best fitting asset bundle. More...
 
static SpecificBundleName  RemapVariantName_NoHash (string assetBundleName, AssetBundleManifest manifest, string[] activeVariants)
  Remaps the asset bundle name to the best fitting asset bundle variant. More...
 
static string  EscapeBundleName (string source)
 

Public Attributes

bool  escapeUrls = false
  should we escape bundle names when making urls? More...
 
bool  bundleNamesHaveHash = true
  Were the asset bundles created with the BuildAssetBundleOptions.AppendHashToAssetBundleName on? More...
 

Static Public Attributes

static ILogger  Logger
  Assign a logging handler More...
 

Protected Member Functions

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

Protected Attributes

string  baseDownloadingURL
 

Properties

IBundleDirectory  ActiveDirectory [get]
  Get the current directory More...
 
string[]  ActiveVariants [get, set]
  The list of bundle variants we should try to load More...
 
- Properties inherited from IBundleDirectoryLoader
IBundleDirectory  ActiveDirectory [get]
  Get the current directory More...
 

Detailed Description

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

Member Function Documentation

◆ AmountToDownload()

bool AmountToDownload ( BundleManager  manager,
string  sanitizedLabel,
out uint  totalSize,
out uint  alreadyDownloaded 
)
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 IBundleDirectory.

◆ GetStreamingAssetsName()

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

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

Parameters
sanitizedLabel
url
Returns

Implements IBundleDirectory.

◆ Initialize()

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

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 IBundleDirectoryLoader.

◆ IsReady()

bool IsReady ( BundleManager  manager )

Once ready, presumed always ready.

Implements IBundleDirectory.

◆ RemapBundleName_WithHash()

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

◆ RemapVariantName_NoHash()

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

◆ SanitizeBundleName()

static string SanitizeBundleName ( string  assetBundleName,
bool  bundleNamesHaveHash 
)
static

◆ StartBundle()

IEnumerator StartBundle ( BundleManager  manager,
string  sanitizedLabel 
)
Parameters
manager
Returns

Implements IBundleDirectory.

◆ TryGetDependencies()

bool TryGetDependencies ( BundleManager  manager,
string  sanitizedLabel,
out IEnumerable< string >  outRequiredSanitizedLabelList 
)
Parameters
sanitizedLabel
outRequiredSanitizedLabelList
Returns
was bundle found?

Implements IBundleDirectory.

◆ TryLookupBundle()

bool TryLookupBundle ( BundleManager  manager,
string  sanitizedLabel,
out string  outUrl,
out Hash128  outHash,
out string  outCrc 
)
Parameters
sanitizedLabel
outUrl
outHash
outCrc
Returns
was bundle found?

Implements IBundleDirectory.

Member Data Documentation

◆ bundleNamesHaveHash

bool bundleNamesHaveHash = true

◆ escapeUrls

bool escapeUrls = false

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

◆ Logger

ILogger Logger
static

Property Documentation

◆ ActiveDirectory

IBundleDirectory ActiveDirectory
get

Only valid after Initialize completes without error.

◆ ActiveVariants

string [] ActiveVariants
getset

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.