Unity获取Texture的使用大小
Texture tx= Selection.activeObject as Texture;
var TextureUtilType = Types.GetType ("UnityEditor.TextureUtil", "UnityEditor.dll");
MethodInfo methodInfo = TextureUtilType.GetMethod ("GetStorageMemorySize", BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public);
int txSize = methodInfo.Invoke(null,new object[]{tx});
其中 methodInfo.Invoke(null,new object[]{tx});中的数组的长度是根据你调用的Method的参数来决定的
启动 dll中
internal static class TexutreUtil
{
public static int GetStorageMemorySize(Texture t)
{
...
}
}