So I have this VR app with a canvas in the world.
I have a raw image inside the canvas and when activated I load a picture from Streaming Assets, this works great in the engine but when I build it and run it in Oculus 2, the pictures just wont load, like nothing is happening.
I have a similar code for some text and this works great.
Here’s my code on how I load the image.
public void ImagesButton()
{
try
{
string pathToPictures = Application.streamingAssetsPath + "/" + GetName() + "/Pictures/";
imagesFiles = Directory.GetFiles(pathToPictures, "*.jpg", SearchOption.AllDirectories);
IEnumerator coroutine = LoadImageIE(imagesFiles[0]);
StartCoroutine(coroutine);
}
catch
{
Debug.Log("no images folder");
}
currentImage = 0; //reset flag
}
private IEnumerator LoadImageIE(string imagePath)
{
UnityWebRequest request = UnityWebRequestTexture.GetTexture(imagePath);
yield return request.SendWebRequest();
try
{
canvasForDisplays.transform.GetChild(2).gameObject.transform.GetChild(0).gameObject.GetComponent<RawImage>().texture = DownloadHandlerTexture.GetContent(request);
canvasForDisplays.transform.GetChild(2).gameObject.SetActive(true);
}
catch
{
Debug.Log("no image file");
}
}
In the image are the settings of the canvas and the raw image object.