You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1019 B
42 lines
1019 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class loadMaskFile : MonoBehaviour
|
|
{
|
|
RawImage rawImage;
|
|
public string imagePath;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
rawImage = GetComponent<RawImage>();
|
|
|
|
if (File.Exists(imagePath))
|
|
{
|
|
byte[] imageBytes = File.ReadAllBytes(imagePath);
|
|
Texture2D texture = new Texture2D(2, 2); // Initial size, will be resized by LoadImage
|
|
texture.LoadImage(imageBytes);
|
|
|
|
if (rawImage != null)
|
|
{
|
|
rawImage.texture = texture;
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("RawImage component not assigned!");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("Image file not found at path: " + imagePath);
|
|
}
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|
|
|