Created
April 13, 2016 11:38
-
-
Save tm8r/035497b4d7af317299f4770ce0cfad67 to your computer and use it in GitHub Desktop.
EditorAssetBundle
This file contains 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 System.Reflection; | |
using UnityEditor; | |
public class EditorAssetBundle : EditorWindow | |
{ | |
Object[] objs; | |
[MenuItem ("Window/EditorAssetBundle")] | |
static void Do () | |
{ | |
GetWindow<EditorAssetBundle> (); | |
} | |
void OnEnable () | |
{ | |
MethodInfo info = typeof(EditorGUIUtility).GetMethod ("GetEditorAssetBundle", BindingFlags.Static | BindingFlags.NonPublic); | |
AssetBundle bundle = info.Invoke (null, new object[0]) as AssetBundle; | |
objs = bundle.LoadAllAssets (); | |
} | |
void OnDisable () | |
{ | |
objs = null; | |
EditorUtility.UnloadUnusedAssetsImmediate (); | |
} | |
Vector2 pos; | |
void OnGUI () | |
{ | |
pos = EditorGUILayout.BeginScrollView (pos); | |
foreach (Object texture in objs) { | |
GUILayout.Label (EditorGUIUtility.ObjectContent (texture, texture.GetType ())); | |
} | |
EditorGUILayout.EndScrollView (); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment