Exemple #1
0
    IEnumerator LoadImagesEnumerator(FileInfoScript newFile, FileInfo file)
    {
        Texture2D tex = new Texture2D(1, 1);

        byte[] fileData = File.ReadAllBytes(file.FullName);
        tex.LoadImage(fileData);
        tex.Apply();
        newFile.fileImage.sprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), new Vector2(0.5f, 0.5f), 100.0f);
        yield return(new WaitForChangedResult());
    }
Exemple #2
0
    private void LoadPrefabsOfFiles()
    {
        if (content.transform.childCount != files.Length)
        {
            FileInfoScript newFile = Instantiate(fileImagePrefab, content.transform).GetComponent <FileInfoScript>();

            newFile.fileName.text = files[content.transform.childCount].Name;

            StartCoroutine(LoadImagesEnumerator(newFile, files[content.transform.childCount]));
        }
    }