1130917 Save PIC
by 黃國哲 2024-09-17 18:32:02, 回應(0), 人氣(75)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
public class SaveTexture : MonoBehaviour
{
public Texture2D texture;
// Start is called before the first frame update
void Start()
{
}
public void Save()
{
byte[] bytes = texture.EncodeToPNG();
string fileName = "MyTexture.png";
File.WriteAllBytes(Application.persistentDataPath + "/" + fileName, bytes);
}
}
回應