Skip to content

Instantly share code, notes, and snippets.

@wmiller
Created February 3, 2014 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmiller/8792631 to your computer and use it in GitHub Desktop.
Save wmiller/8792631 to your computer and use it in GitHub Desktop.
XML Database ValidateAssetBundleAssetsInternal
private static void ValidateAssetBundleAssetsInternal()
{
// Get all asset infos from the database and iterate over them
AssetInfo[] assetInfos = Database.Instance.GetEntries<AssetInfo>();
foreach (AssetInfo assetInfo in assetInfos)
{
// Load the object referenced by the asset info. Warn if the
// object fails to load
Object asset = Resources.LoadAssetAtPath<Object>(assetInfo.Path);
if (!asset)
{
Debug.LogWarning("Invalid Asset: " + assetInfo.Path + " in AssetInfo: " + assetInfo.DatabaseID.ToString());
}
}
// Clean up
Resources.UnloadUnusedAssets();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment