cancel
Showing results for 
Search instead for 
Did you mean: 

UnityWebRequest Not Working on Quest 3 - "cannot resolve destination host" error

mo84dan5
Explorer

Hello everyone,

I'm currently developing an application for the Quest 3 using Unity. I've encountered an issue where UnityWebRequest isn't functioning as expected. When I attempt to make a request, I receive the error message "cannot resolve destination host."

I've tried searching for a solution on the Unity forums but couldn't find any relevant answers. Has anyone else faced a similar problem? If so, could you please share any solutions or workarounds?

Any assistance would be greatly appreciated.

Thank you in advance!

12 REPLIES 12

mo84dan5
Explorer

I apologize for not mentioning it earlier, but I'm using Unity version 2022.3.11.f1 for my project.

Cain_Bloodbane
Adventurer

I have run into this as well... quite frustrating because I have found several topics about this and none seem to resolve it. It seems to be a problem for 2022 in general, maybe even 2021 as well. I loaded an old project from before WWW got replaced with UnityWebRequest and back then it worked for me in older projects, I can still load that project and download or load stuff from the web.

Found this thread where someone might have found a workaround, but it has not worked for me so far:
https://discussions.unity.com/t/web-requests-fail-on-android-meta-quest-2-only/287322

Cain_Bloodbane
Adventurer

I think I managed to find a thread that has a reason why this problem exists and a possible solution. Downgrading the OpenXR plugin to 1.7 or add Internet permission in a custom android manifest.

https://forum.unity.com/threads/unity-removes-android-permission-internet-in-the-build-apk-after-bui...

mo84dan5
Explorer

Thank you so much, Cain_Bloodbane!

After going through the discussion in the link you provided, I managed to resolve the issue. For those who might face a similar problem in the future, here's what I did:

  1. I did not downgrade the OpenXR plugin.
  2. I did not directly modify the android manifest (I believe the settings made the necessary changes during the build).
  3. I changed "Allow downloads over HTTP" to "Always allow" under Project Settings > Player > Configuration.
  4. I set "Internet Access" to "Require" under Project Settings > Player > Configuration.
  5. In Project Settings > XR Plug-in Management > OpenXR, under OpenXR Feature Groups > Meta Quest Support, I pressed the gear icon on the right and in the pop-up window, I unchecked "Force Remove Internet ~".

After making these adjustments and building, everything worked as expected.

Again, thank you for pointing me in the right direction!

Does it keep working for you though? For some reason it seems to keep returning to the bug for me. Even if I make a custom manifest. Your solution matches the issue that got reported though:
https://issuetracker.unity3d.com/issues/openxr-option-forceremoveinternetpermission-is-enabled-by-de...

But in my experience, the setting keeps resetting itself and sometimes it somehow kept being in effect even when it was disabled and I compiled and then checked the setting after. I think it might have to be the order you do things with it.

The thing I am trying to do is use Gltfast to load GLTF models from the web but with that I do also run into another problem where it cannot compile required shaders or it fails to include those shaders. I got it to work once two days ago, but since then I have not been able to get it to work again. Even though the only thing I did was open up the project and trying to compile it to my VR headset again.

So I am trying to figure out the logic of it, especially since I have more than one error. So far I have not managed to make the solution as clean as you did, so for the third or fourth time now I will try to make a new project and then do what you did to see if that works. Also I will try to have it as a desktop app before adding Gltfast before converting to Android. Maybe that will help avoid the shader problem that as far as I can find should have been solved long ago.

Cain_Bloodbane
Adventurer

Finally got it working, this time the only thing I did was flip the setting to force disable Internet in OpenXR under Meta Quest Support". It did activate that setting once, but I disabled it again. I think the problem with Gltfast was maybe that I needed to generate "shader includes". Edit -> Rendering -> "Generate Shader Includes"
But I guess it might also just be that I needed to compile it a second time.

I will experiment some more. Very strange how many problems it caused me earlier, but I guess maybe some of the solutions I implemented ended up causing more problems instead of helping.

But now hopefully I can begin to see if I can use Unity Mesh Simplifier to help me create LODs at runtime on the Quest, so I can make it possible for users to control the quality of each mesh they import.

Cain_Bloodbane
Adventurer

So I did even more testing and this is becoming more and more frustrating.

It seems both the "force disable Internet" and the shader issue are both problems that decide to come back now and again. So every time I make a change, I should expecting having to build and run the app twice, because the first time it always fail... and then if it works the second time, then the "force disable Internet" option might have become enabled again at some point.

Oh well, at least now I can get a working build, even if it ends up taking 3 or more attempts every time. Because once I enable Internet again, the shader problem might return, and then after that... the Internet problem might return. The bug that keeps on bugging.

SimonDarksideJ
Protege

Quick update to anyone coming across this, to resolve this successfully, you have to:
* Edit your project manifest and update the OpenXR version to "1.9.1" Manually (doesn't show up in Unity yet)
* Return to Unity and let it update
* Check your OpenXR settings, likely they will need to be refreshed (internal thing)
* Select the OpenXR tab under the XR Settings (Player Settings window)
* With the Android tab selected, find the "Meta Quest Support" option and click the COG to the right of it
* DESELECT the option to "Force Remove Internet"
Your projects when deployed to the quests will now work as they should and have internet access again.

I maybe can understand why this option was added for "some" projects, but to add it, NOT document it and FORCE it ON by default is beyond me (since in C# and C++, a boolean is FALSE by default, so they would have had to intentionally set it), one can only hope this is a small blunder when they were testing it.

But on with the show, there is one day of pulling hair out I won't get back.

THANK YOU, what a bizarre issue. This fixed it for me!

 

Let me add to this I did also need to go into Player Settings>Player>Other Settings Configuration section and set internet access to "Require" instead of "Auto"