Skip to content

Instantly share code, notes, and snippets.

@tm8r
Created April 13, 2016 11:38
Show Gist options
  • Save tm8r/035497b4d7af317299f4770ce0cfad67 to your computer and use it in GitHub Desktop.
Save tm8r/035497b4d7af317299f4770ce0cfad67 to your computer and use it in GitHub Desktop.
EditorAssetBundle
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