void loadPicture(string filePath)
{
DirectoryInfo info = new DirectoryInfo(filePath);
FileInfo[] infos = info.GetFiles("*.jpg");
SpriteArray = new Texture2D[infos.Length];
int index = 0;
foreach (var file in infos)
{
//Debug.Log(file.Name);
//读取当前文件流
FileStream stream = file.OpenRead();
//创建byte[]数据变量 指定为当前文件流的长度
byte[] bytes = new byte[stream.Length];
//读取文件流 将数据传给bytes
stream.Read(bytes, 0, bytes.Length);
Texture2D tex2D = new Texture2D(1920, 1080);
tex2D.name = file.Name;
tex2D.LoadImage(bytes);
tex2D.Apply();
SpriteArray[index] = tex2D;
index++;
stream.Close();
}
}