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(); 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() { } }