Пример #1
0
        private void LoadText()
        {
            string csvPath = System.IO.Path.Combine(Application.streamingAssetsPath, "Csv/sample.csv");

            StreamingAssetsLoader.ReadAllBytes(csvPath, bytes =>
            {
                if (bytes == null)
                {
                    Debug.Log($"ファイルが存在しません Path:{csvPath}");
                    return;
                }
                string txt = Encoding.UTF8.GetString(bytes);

                Debug.Log(txt);
            });
        }
Пример #2
0
        private void LoadImage()
        {
            string imgPath = System.IO.Path.Combine(Application.streamingAssetsPath, "Image/sample.png");

            StreamingAssetsLoader.ReadAllBytes(imgPath, bytes =>
            {
                if (bytes == null)
                {
                    Debug.Log($"ファイルが存在しません Path:{imgPath}");
                    return;
                }

                Texture2D texture = new Texture2D(1024, 1024);

                texture.LoadImage(bytes);

                image.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
            });
        }