Init repository

This commit is contained in:
2024-01-27 08:49:55 +08:00
commit f86a72355b
311 changed files with 121739 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
using System.IO;
using UnityEngine;
using UnityEngine.UI;
public class LoadImageFromStreamingAssets : MonoBehaviour
{
public Image LoadToObject;
public string ImagePathFromStreamingAssets;
void Start()
{
Texture2D texture = new(2,2);
texture.LoadImage(File.ReadAllBytes(Path.Combine(Application.streamingAssetsPath, ImagePathFromStreamingAssets)));
Debug.Log("Loaded texture " + texture.name);
if (LoadToObject)
{
LoadToObject.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0, 0));
}
}
}