Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public is Asset Bundle Loaded / Downloading #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions AssetBundleManager/AssetBundleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,48 @@ public void UnloadBundle(string bundleName, bool unloadAllLoadedObjects, bool fo
}
}

/// <summary>
/// Returns if the Asset Bundle is already loaded
/// </summary>
public bool IsAssetBundleLoaded(string bundleName)
{
if (activeBundles.ContainsKey(bundleName)) {
return true;
} else {
return false;
}
}

/// <summary>
/// Returns if the Asset Bundle is already loaded (out Bundle if loaded)
/// </summary>
public bool IsAssetBundleLoaded(string bundleName, out AssetBundle bundle)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a minor thing, but could you rename this to TryGetAssetBundle? That way it matches c# conventions that have similar functionality.

{
AssetBundleContainer active;
if (activeBundles.TryGetValue(bundleName, out active))
{
bundle = active.AssetBundle;
return true;
}
else
{
bundle = null;
return false;
}
}

/// <summary>
/// Returns if the Asset Bundle is already downloading
/// </summary>
public bool IsAssetBundleDownloading(string bundleName)
{
if (downloadsInProgress.ContainsKey(bundleName)) {
return true;
} else {
return false;
}
}

/// <summary>
/// Caches the downloaded bundle and pushes it to the onComplete callback.
/// </summary>
Expand Down