private static TextureUtility.SaveTextureInfo Convert(SavedTextureInfo info) { TextureFormat format = TextureFormat.R8; foreach (var val in System.Enum.GetValues(typeof(TextureFormat))) { if (val.ToString() == info.rawFormat) { format = (TextureFormat)val; break; } } TextureUtility.SaveTextureInfo convert = new TextureUtility.SaveTextureInfo(info.path, info.type, info.width, info.height, format, info.mipCount); return(convert); }
public static Texture2D LoadTexture(string basePath, SavedTextureInfo info) { var converted = Convert(info); return(TextureUtility.LoadTexture(basePath, converted) as Texture2D); }