Hello everyone .
I am working on an hololens application and until yesterday i was able to simple load a UI image from the streaming asset path . Today with the following code
string completePath = path + "/" + imageName;
using(WWW www=new WWW(completePath))
{
yield return www;
if (www.error == null)
{
Texture2D tex = www.texture;
sprite = Sprite.Create(tex, new Rect(Vector2.zero, new Vector2(tex.width, tex.height)), new Vector2(0.5f, 0.5f));
}
else
print(completePath+" texture not found");
}
i am not able anymore to load a sprite because i get a WWW error and the www.texture is always empty.
Same with the unitywebrequest method below
UnityWebRequest www = UnityWebRequestTexture.GetTexture(completePath);
yield return www.SendWebRequest();
if (!www.isHttpError)
{
Texture2D tex = DownloadHandlerTexture.GetContent(www);
sprite = Sprite.Create(tex, new Rect(Vector2.zero, new Vector2(tex.width, tex.height)), new Vector2(0.5f, 0.5f));
}
else
{
Debug.Log(completePath + " image not found");
}
it works without problem in the editor , at the moment i can't test it on a device .
I update visual studio and UWP SDK yesterday, don't know if it should be a problem.
Thank you guys.
EDIT: I try to use also the system path combine string builder without success.
↧