Hi everyone!
I made a game in which I can upload images from external folders. To do this, I used the WWW class. Now, the process works, but a warning appears saying: “WWW class is obsolete: Use UnityWebRequest, a fully featured replacement which is more efficient and has additional features”.
So I tried to replace WWW with UnityWebRequest, but it doesn’t work, and I can’t figure it out.
This is the code I used:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEditor;
public class FileManager : MonoBehaviour
{
string path;
public RawImage image;
public void OpenExplorer()
{
path = EditorUtility.OpenFilePanel("Overwrite with png", "", "png");
GetImage();
}
void GetImage()
{
if (path != null)
{
UpdateImage();
}
void UpdateImage()
{
WWW www = new WWW("file:///" + path);
image.texture = www.texture;
}
}
}
Anyone can help me, please? Thank you so much!