mapbox / mapbox-unity-sdk

Mapbox Unity SDK - https://www.mapbox.com/unity/
Other
725 stars 210 forks source link

Clarification on Directions API querying in 'TrafficAndDirections' scene #1851

Open arthurwcheng opened 2 years ago

arthurwcheng commented 2 years ago

Hi there,

I wanted to get a quick clarification in the 'TrafficAndDirections' example scene located in Mapbox\Examples\1_DataExplorer\TrafficAndDirections.

Whenever DirectionsFactory.cs updates the navigation route display on the map and Directions.Query is called to make a request from the Directions API, does each request count towards our Mapbox account's free-tier usage limit of 100,000 free requests per month?

(i.e. if update frequency is set to every 2 seconds, we are effectively adding one Directions API request every 2 seconds to our usage statistics)

Thanks! Arthur

arthurwcheng commented 2 years ago

I also noticed the Query() method is linked to the _map.OnInitialized and _map.OnUpdated delegates in DirectionsFactory.cs. This seems to bypass the QueryTimer coroutine, where it will call on Query() every frame that the map gets updated.

Does the same principle apply in this case then that you'd be making a Directions API request every frame that Query() is called?