https://www.youtube.com/watch?v=mh5oL3A ... e=youtu.be - работает и в эдиторе и в сборке
https://www.youtube.com/watch?v=Vh_XkNwThg4 - работает только в эдиторе, но стандартный проводник
Для загрузки изображений, аналогично как в видосе.
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
using SmartDLL;
public class Explorer4 : MonoBehaviour
{
public Button openExplorerButton;
public SpriteRenderer eSpriteRenderer;
public SmartFileExplorer fileExplorer = new SmartFileExplorer();
private bool readJpg = false;
void OnEnable()
{
openExplorerButton.onClick.AddListener(delegate { ShowExplorer(); });
}
// Update is called once per frame
void Update()
{
if (fileExplorer.resultOK && readJpg)
{
ReadJpg(fileExplorer.fileName);
readJpg = false;
}
}
void ShowExplorer()
{
string initialDir = @"C:\";
bool restoreDir = true;
string title = "Open a JPG File";
string defExt = "jpg";
string filter = "jpg files (*.jpg)|*.jpg";
fileExplorer.OpenExplorer(initialDir, restoreDir, title, defExt, filter);
readJpg = true;
}
void ReadJpg(string path)
{
WWW www = new WWW("file:///" + path);
var mySprite = Sprite.Create(
http://www.texture, new Rect(0.0f, 0.0f,
http://www.texture.width,
http://www.texture.height), new Vector2(0.5f, 0.5f), 100.0f);
eSpriteRenderer.sprite = mySprite;
}
}