using Newtonsoft.Json; using System.Collections.Generic; using System; using UnityEngine; using System.Runtime.InteropServices; public class WebGl : MonoBehaviour { public byte[] image { get { return _images; } } byte[] _images; public void GetDragAndDrop(string base64Json) { try { Debug.Log("JSON µ¥ÀÌÅÍ ¼ö½Å ¿Ï·á"); // JSON ¹®ÀÚ¿­À» ¸®½ºÆ®·Î º¯È¯ List base64List = JsonConvert.DeserializeObject>(base64Json); if (base64List == null || base64List.Count == 0) { Debug.LogError("Base64 ¸®½ºÆ®°¡ ºñ¾î ÀÖ½À´Ï´Ù."); return; } // ù ¹øÂ° À̹ÌÁö¸¦ _images¿¡ ÀúÀå (¿©·¯ °³ ÀúÀåÇÏ·Á¸é List »ç¿ë) _images = Convert.FromBase64String(base64List[0]); Debug.Log("À̹ÌÁö º¯È¯ ¿Ï·á, Å©±â: " + _images.Length + " ¹ÙÀÌÆ®"); } catch (Exception e) { Debug.LogError("JSON ó¸® Áß ¿À·ù ¹ß»ý: " + e.Message); } } [DllImport("__Internal")] private static extern void GetImageDataJS(byte[] array, int length); public void ReceiveImageData(byte[] data) { Debug.Log("½ÃÀÛ"); _images = data; Debug.Log($"À̹ÌÁö µ¥ÀÌÅÍ ¼ö½Å ¿Ï·á: {_images.Length} ¹ÙÀÌÆ®"); } }