Retrieve Date and Time from the Internet

As a way to prevent cheating, I wanted to pull the current Date and Time from the net. So I tried this, and it works just fine in editor. However, when I deploy to WebGL, it gets nothing back in response. The code executes, but returns netTime as a null string. Again, in editor, it works exactly as intended and returns the date/time as a string. WebGL fails. Any ideas why? My understanding is that UnityWebRequest should be working with WebGL per the documentation (I'm using 5.5, it says implemented by 5.3)?

Tried multiple sites (besides MS), they all work locally, none work in WebGL. My guess atm is it works locally b/c there is no cross-domain issue (CORS), but once in browser, it's hitting a CORS issue. I'm trying a CORS proxy to see if that fixes it.

Tried multiple sites (besides MS), they all work locally, none work in WebGL. My guess atm is it works locally b/c there is no cross-domain issue (CORS), but once in browser, it's hitting a CORS issue. I'm trying a CORS proxy to see if that fixes it.

Click to expand...

Nope, even when I use a CORS proxy, it gets rid of the error returned, but I'm still getting absolutely nothing back. Sigh. Any ideas network knowledgeable folks? I'm amenable to alternate solutions if there's a slicker way to get date/time from the net?

Yah it's not CORS, I used https://crossorigin.me to see if that was the problem. It doesn't solve it, I'm getting absolutely nothing back in WebGL, although it seems to work in editor and PC platform...

I double checked I'm not getting any error with myHttpWebRequest.error is .isError. No error, just null coming back on WebGL.

I actually couldn't get his NTP script to work at all. Even then, the issue isn't that above method doesn't work, it does! It just doesn't work on WebGL!

That said, I finally got it to return me SOME text using WWW, so I'll just go down that road and see if I can find a website without ridiculous text for me to parse Really should work with UnityWebRequest though...

As a way to prevent cheating, I wanted to pull the current Date and Time from the net. So I tried this, and it works just fine in editor. However, when I deploy to WebGL, it gets nothing back in response. The code executes, but returns netTime as a null string. Again, in editor, it works exactly as intended and returns the date/time as a string. WebGL fails. Any ideas why? My understanding is that UnityWebRequest should be working with WebGL per the documentation (I'm using 5.5, it says implemented by 5.3)?

Oops...

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.