Hello everyone.
The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
Texture from URL not loading in Hololens and emulator
I've made a project in Unity with a plane object. My idea was to load in a Google Maps image and project it on the plane. This works in the Unity editor but on the Hololens and the emulator it doesn't load inthe texture and gives me the basic color of the plane. I've both tried the WWW and the UnityWebRequest calls to load in: Google Maps image and a basic water texture from url.
Code (that matters):
IEnumerator GetTexture() { UnityWebRequest req= UnityWebRequest.GetTexture("http://www.sharecg.com/images/medium/3740.jpg"); yield return req.Send(); if(req.isError) { Debug.Log(req.error); } else { gameObject.GetComponent<Renderer>().material.mainTexture = ((DownloadHandlerTexture)req.downloadHandler).texture; }
Tagged:
0
Best Answer
-
Hi I used the code below on a cube and it worked in both Editor and on my Hololens
using UnityEngine; using System.Collections; using UnityEngine.Networking; public class TextureGrabber : MonoBehaviour { public string myURL = "http://www.sharecg.com/images/medium/3740.jpg"; void Start() { StartCoroutine(GrabWWWTexture()); } IEnumerator GrabWWWTexture() { UnityWebRequest www = UnityWebRequest.GetTexture(myURL,false); www.SetRequestHeader("Accept", "image/*"); Debug.LogError("Downloading..."); yield return www.Send(); while (!www.isDone){ Debug.LogError("."); yield return null; } if(www.isError) { Debug.Log(www.error); } else { Texture myTexture = ((DownloadHandlerTexture)www.downloadHandler).texture; gameObject.GetComponent<Renderer>().materials[0].mainTexture = myTexture; } }
}
creative mind, free thinker, dreamer, maker, mostly working on games and doodling around with gadgets, Sphered Cazual/Elite/Master of the Universe/Dad/Husband @mariovermeulen
1
Answers
Did you enable InternetClient and/or InternetclientServer? in publishing settings/capabilities?
Edit > Project Settings > Player > select Windows Store icon > Publishing Settings
creative mind, free thinker, dreamer, maker, mostly working on games and doodling around with gadgets, Sphered Cazual/Elite/Master of the Universe/Dad/Husband @mariovermeulen
I did, both of them
Hi I used the code below on a cube and it worked in both Editor and on my Hololens
}
creative mind, free thinker, dreamer, maker, mostly working on games and doodling around with gadgets, Sphered Cazual/Elite/Master of the Universe/Dad/Husband @mariovermeulen
It works now. Thanks for the help!
Glad you got it to work!
creative mind, free thinker, dreamer, maker, mostly working on games and doodling around with gadgets, Sphered Cazual/Elite/Master of the Universe/Dad/Husband @mariovermeulen