Created
July 14, 2017 12:21
-
-
Save glitchersgames/3b75559055ac007406d66ff0c1207ece to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Collections; | |
using System.Collections.Generic; | |
public static class AssetBundleUtil | |
{ | |
public static void FindAllAssetsInBundle( string assetBundleName ) | |
{ | |
List<Object> assets = new List<Object>(); | |
foreach( var assetPathAndName in AssetDatabase.GetAssetPathsFromAssetBundle(assetBundleName) ) | |
{ | |
string nameWithoutPath = assetPathAndName.Substring( assetPathAndName.LastIndexOf( "/" ) + 1 ); | |
string name = nameWithoutPath.Substring( 0, nameWithoutPath.LastIndexOf( "." ) ); | |
Debug.LogFormat( "{0}:{1} @ {2}", assetBundleName, name, assetPathAndName); | |
assets.Add( AssetDatabase.LoadAssetAtPath( assetPathAndName, typeof(Object) ) ); | |
} | |
Selection.objects = assets.ToArray(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment