Open wilhelmberg opened 7 years ago
I suspect this will need to be implemented in the Unity
layer.
See:
IEnumerator ValidateToken(string token)
{
_lastAccessToken = token;
// TODO: implement safer url formatting?
var www = new WWW("https://api.mapbox.com/tokens/v2?access_token=" + token);
while (!www.isDone)
{
yield return 0;
}
var json = www.text;
if (!string.IsNullOrEmpty(json))
{
ParseTokenResponse(json);
}
}
In MapboxConfigurationWindow.cs
for an example. This worked here because the url is hardcoded and not abstracted in the cs
layer. That said, I think we can just use the old HTTPRequest
for editor and decide which version to delegate to in MapboxAccess
.
Alternatively, you should be able to hook into the editor's update: http://answers.unity3d.com/questions/39313/how-do-i-get-a-callback-every-frame-in-edit-mode.html.
To make the
Location Search
widget work when Unity Editor is not playing we might need a non-threaded implementation of HTTPRequest. Or, find a way how to get back to the main thread without the message pump being called viaUpdate()
.