-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
triage WebGL builds #19
Comments
|
I think the problem is with
If I remove the Even copying Unity's own public class script1 : MonoBehaviour
{
private string _accessPath;
void Start()
{
_accessPath = Path.Combine(Application.streamingAssetsPath, "MapboxAccess.text");
#if !UNITY_ANDROID && !UNITY_WEBGL
Debug.Log("called on (almost) all players");
#else
Debug.Log("called on Android and WebGL");
#endif
#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_WEBGL)
Debug.Log("UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_WEBGL)");
#else
Debug.Log("ELSE - UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_WEBGL)");
#endif
Debug.Log("_accessPath:" + _accessPath);
IEnumerator e = GetToken();
e.MoveNext();
e.MoveNext();
}
IEnumerator GetToken()
{
#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_WEBGL)
yield return null;
Debug.Log("token loaded (via 'File'): " + File.ReadAllText(_accessPath));
#else
WWW www = new WWW(_accessPath);
yield return www;
Debug.Log("token loaded (via 'WWW'): " + www.text);
#endif
}
} |
I think
While our approach works on Android it does not work with WebGL. With the above patch in place I just hard coded my token and now WebGL works 🎉 So far tried:
It's great to see memory caching working nicely with those two examples. |
@BergWerkGIS Did you try |
Also, now that I see this example, we might be able to greatly simplify this class (logic). |
Yes, tiles start loading before token is availabe -> 401s - Not authenticated. |
After fiddling around with this for a while, I think we have at least three possible paths forward:
The first option is more difficult, because geocoding and directions requests would need separate queueing systems. The second is less friendly, but generally safer. Do you see other options? |
As the Unity docs (WebGL Networking) explicitly state, we shouldn't use
I tried everything I could think of to make that Another hint from @david-rhodes 🙏 seems more promising: I tried
Branch: https://github.com/mapbox/mapbox-unity-sdk/tree/BergWerkGIS-fix-mapboxaccess-for-webgl Changes
TODO
|
Done: #109 |
WebGL builds of our examples aren't working in latest develop.
@MateoV - do you have bandwidth to investigate this?
The text was updated successfully, but these errors were encountered: