I need to loading 100 4k image when start application.
I use texture2d.loadImage(filepath) in coroutine to load .
But it slowly and will add memory
IEnumerator LoadTexture()
{
foreach (var fi in directoryInfo.GetFiles())
{
if (fi.Extension.Equals(".jpg", System.StringComparison.OrdinalIgnoreCase) ||fi.Extension.Equals(".png", System.StringComparison.OrdinalIgnoreCase))
{
string filepath = path + "\\" + fi.Name;
byte[] bytes = File.ReadAllBytes(filepath);
Texture2D texture = new Texture2D(2,2);
texture.LoadImage(bytes);
textures.Add(texture);
}
yield return null;
}
}