在Unity中,要获取Texture的内存文件大小,可以使用UnityEditor.TextureUtil类中的一些函数。这些函数提供了获取存储内存大小和运行时内存大小的方法。由于UnityEditor.TextureUtil是一个内部类,我们需要使用反射来访问它。 步骤 导入UnityEditor命名空间和System.Reflection命名空间: using UnityEditor; using System.Reflection; 创建一个函数来获取Texture的内存文件大小: public static long GetTextureFileSize(Texture2D texture) { long fileSize = 0; // 使用反射获取UnityEditor.TextureUtil类的Type Type textureUtilType = typeof(TextureImporter).Assembly.GetType("UnityEditor.TextureUtil"); //...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with return
Contact return, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack