Comments (10)
Commenting validation and hard coding the token works:
Although there seem to be other problems too as buildings and their styles are still missing.
EDIT
After commenting ValidateMapboxAccessFile()
and hard coding the token the rest works as expected:
from mapbox-unity-sdk.
@BergWerkGIS Yeah, since I don't have Android I was unable to test myself. I thought that @MateoV had tested to ensure everything was working as expected, though.
The actual loading of the text file is done with WWW
, but as you mentioned ValidateMapboxAccessFile
fails because the "file is not found" on Android. I think we should just #if !UNITY_ANDROID
the contents of this method and do some extra error checking in IEnumerator LoadMapboxAccess()
.
from mapbox-unity-sdk.
@BergWerkGIS do you know if the directory is not able to be found, or if the file does not exist?
if (!Directory.Exists(Application.streamingAssetsPath) || !File.Exists(_accessPath)) {
throw new InvalidTokenException("Please configure your access token in the menu!");
}
from mapbox-unity-sdk.
Regarding Problem 2
, we may have to hold a queue of requests until the async read is done, then fire them off. This seems like a simple fix, but I won't be able to test. Do you have a better idea?
from mapbox-unity-sdk.
do you know if the directory is not able to be found, or if the file does not exist?
I think Directory.Exists()
and File.Exists()
don't work with the url that points into the jar file.
Regarding
Problem 2
, we may have to hold a queue of requests until the async read is done, then fire them off. This seems like a simple fix, but I won't be able to test. Do you have a better idea?
I would prefer to somehow make loading of the token sync.
Otherwise all code that requests anything would have to check and wait till the token is available.
Will have a look tomorrow.
How about not using IEnumerator
and yield
but something like:
void LoadMapboxAccess() {
var request = new WWW(_accessPath);
while (!request.isDone) { Thread.Sleep(10); }
AccessToken = request.text;
}
from mapbox-unity-sdk.
How about not using IEnumerator and yield?
I never thought to use WWW
like that, but should be possible. We would have to include a timeout or error handling to prevent freezing the entire application. Android is so fragmented, you never know what device or OS this will not work for 😏.
from mapbox-unity-sdk.
@david-rhodes and I tried a couple of solutions wanted to get your thoughts on these (sorry the diffs aren't super helpful here) Tested on and Android device and the styles and buildings demo loads. https://mapbox.slack.com/files/isiyu/F53553D55/image_uploaded_from_ios.mp4
@BergWerkGIS wanted to get your thoughts on which solution to go with for now
option A: cache requests 3ffc117
What the logs look like for a successful run, with a valid token:
option B: thread sleep 5125bce
from mapbox-unity-sdk.
For clarity, Option B
works. Please note: #if !_UNITY_ANDROID
should be #if !UNITY_ANDROID
. Testing without a token was just to see what exception was thrown. The correct InvalidTokenException
was thrown. 👍
@BergWerkGIS this was your suggestion, and it seems to work as intended. Any idea why your implementation did not work earlier today? In any case, we would probably want to implement a timeout for the while
loop and throw an exception in the event the WWW
never finishes.
As mentioned in slack, Option A
is likely "safer," but it is less efficient and does not currently allow cached requests to be cancelled (but this is seriously an edge case). We can fix this, but I'd like to know your thoughts, first.
from mapbox-unity-sdk.
@BergWerkGIS this was your suggestion, and it seems to work as intended. Any idea why your implementation did not work earlier today?
No idea, maybe some error I missed during deploy and an old version was used on the device.
Works today. 🎉
I'd like to know your thoughts, first.
I'd prefer Option B
to caching at that level.
My PR for MapboxAccess.cs
, including:
- Android fix
- timeout for
LoadMapboxAccess()
- UWP support
ServerCertificateValidationCallback
to make HttpWebRequest on Mono work with HTTPS requests
from mapbox-unity-sdk.
Fixed: #26
from mapbox-unity-sdk.
Related Issues (20)
- The 3D models on the map change their position when locating is activated.
- Setting the Map Extent Options to CameraBounds at runtime doesn't work HOT 1
- Spawn prefabs upwards with a fixed gap
- why only mapbox street v7 can edit POI prefab
- Mapbox + Unity Cloud Build
- Error: Cannot Initialize non-default texture with negative or zero width HOT 1
- suddort URP ? HOT 2
- How to Apply Texture to Tiles
- Swapped North/South and West/East coordinates in Tile Id To Bounds?
- This project is dead? HOT 12
- Your hardware does not support this application. Failed to load 'libmain.so' java.lang.UnsatisfiedLinkError: dopen failed: library "libmain.so" not found HOT 1
- Can I make changes to AbstractMap's Features?
- Can I make changes to AbstractMap's Map Layers Tileset ID via code during runtime?
- heatmap rendering issue
- Meta Quest 3 Build Issues
- Some Building Meshes get "cutoff"
- Mapbox building:levels property support of Unity SDK HOT 3
- language support for raster tile
- Unity - Mapbox environment "Profiles"
- Not compatible with Unity 6 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapbox-unity-sdk.