Unity Editor version : 2022.2.12f1 ML2 OS version : 1.12.1 Unity SDK version : 2.2.0 Host OS : Windows 11
I made a Flask API to handle requests to Gemini and send responses back to my application. The API works fine in the Unity editor, and I am able to send and receive. However, I run into problems when building to the headset and trying to send and receive from there. I made sure that both my desktop and the headset were connected to the same wifi and also added this line to my manifest (uses-permission android:name="android.permission.INTERNET"). However, I always get a "cannot connect to destination host" error. Are there some settings or other permissions I have to enable in order to allow an insecure connection from the headset? Or are permissions not the origin of the issue? I also tried using the IP address in the API URL, but that didn't work either. I am new to Magic leap and Unity so this might have an obvious solution that I am overlooking.
I recommend launching the log feature through the Magic Leap Hub > Device Bridge the filter by entering "Unity". Also add a few try & catches around the areas with a generic exception.
Something like this:
try
{
// HTTP Request GET / POST / ETC
}
catch (Exception e)
{
Debug.LogError(e);
}
Then in the log, you will be able to see what error is getting generated, either from you mini web service or from the device.
I try to connect to http://[IP]:8000/ and the request ends up timing out on the headset (but works in Unity editor). I watched one of your videos and tested with https://resttesttest.com/ with an http url and was able to connect on the magic leap for that, so I guess it isn't a settings/privacy issue. However, I'm a bit lost on as to why the connection is timing out and if its an issue with the windows firewall or the port I'm using. Any insight would be appreciated!