using System.Text; using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using SFB; [RequireComponent(typeof(Button))] public class CanvasSampleOpenFileImage : MonoBehaviour, IPointerDownHandler { public RawImage output; #if UNITY_WEBGL && !UNITY_EDITOR // // WebGL // [DllImport("__Internal")] private static extern void UploadFile(string gameObjectName, string methodName, string filter, bool multiple); public void OnPointerDown(PointerEventData eventData) { UploadFile(gameObject.name, "OnFileUpload", ".png, .jpg", false); } // Called from browser public void OnFileUpload(string url) { StartCoroutine(OutputRoutine(url)); } #else // // Standalone platforms & editor // public void OnPointerDown(PointerEventData eventData) { } void Start() { var button = GetComponent