using System.Text; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using System.Runtime.InteropServices; using SFB; // StandaloneFileBrowser using TMPro; using System; using System.IO; [RequireComponent(typeof(Button))] public class VR360 : MonoBehaviour, IPointerDownHandler { public GameObject VRPanel; public TMP_InputField SavePath; public void StartPNL() { DOIT.CloseALLPNL(); VRPanel.SetActive(true); } public void OnPointerDown(PointerEventData eventData) { } public void CaptureView(){ { DOIT.CloseALLPNL(); bool saveAsJPEG = true; // Callback to handle saving Action callback = (byte[] bytes) => { if (bytes != null) { // Set the folder path //string folderPath = @"D:\LIBRARY UKITCHENIT"; string folderPath = @SavePath.text; // Ensure the folder exists if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } // Define the file name with timestamp to avoid overwriting string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss"); string path = Path.Combine(folderPath, $"360render_{timestamp}" + (saveAsJPEG ? ".jpeg" : ".png")); // Write the file to the specified path File.WriteAllBytes(path, bytes); Debug.Log("360 render saved to " + path); } else { Debug.LogError("Failed to capture 360 render."); } }; // Call the async capture method I360Render.CaptureAsync(callback, 4096,true, null, true); } } }