<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — How to know when map  has been loaded and drawn?]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=682&amp;type=atom" />
	<updated>2017-10-20T12:14:47Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=682</id>
		<entry>
			<title type="html"><![CDATA[Re: How to know when map  has been loaded and drawn?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2940#p2940" />
			<content type="html"><![CDATA[<p>Really thanks Alex!</p>]]></content>
			<author>
				<name><![CDATA[ppizarro]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=553</uri>
			</author>
			<updated>2017-10-20T12:14:47Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2940#p2940</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to know when map  has been loaded and drawn?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2938#p2938" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Something like:<br /></p><div class="codebox"><pre><code>using System.Collections;
using UnityEngine;

public class CheckFullLoadedExample:MonoBehaviour
{
    private bool isTilesLoaded;
    private bool isRouteFound;
    private IEnumerator timeoutRoutine;

    private void Start()
    {
        OnlineMapsTile.OnAllTilesLoaded += OnAllTilesLoaded;
        OnlineMapsGoogleDirections.Find(&quot;Los Angeles&quot;, &quot;San Francisco&quot;).OnComplete += OnGoogleDirectionsComplete;

        // Time out if something wrong.
        // Strongly recommended.
        timeoutRoutine = FailedTimeout();
        StartCoroutine(timeoutRoutine);
    }

    private IEnumerator FailedTimeout()
    {
        yield return new WaitForSeconds(10);

        Debug.Log(&quot;Failed&quot;);
    }

    private void OnGoogleDirectionsComplete(string response)
    {
        // Parse response
        // ...

        Debug.Log(&quot;Route found&quot;);
        isRouteFound = true;
        CheckFullLoaded();
    }

    private void OnAllTilesLoaded()
    {
        Debug.Log(&quot;All tiles loaded&quot;);
        OnlineMapsTile.OnAllTilesLoaded -= OnAllTilesLoaded;
        isTilesLoaded = true;
        CheckFullLoaded();
    }

    private void CheckFullLoaded()
    {
        if (isRouteFound &amp;&amp; isTilesLoaded)
        {
            StopCoroutine(timeoutRoutine);
            Debug.Log(&quot;Full loaded&quot;);
            OnlineMaps.instance.OnMapUpdated += OnMapUpdated;
            OnlineMaps.instance.Redraw();
        }
    }

    private void OnMapUpdated()
    {
        OnlineMaps.instance.OnMapUpdated -= OnMapUpdated;
        Debug.Log(&quot;The map is fully loaded and drawn.&quot;);
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-10-19T22:58:55Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2938#p2938</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[How to know when map  has been loaded and drawn?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2934#p2934" />
			<content type="html"><![CDATA[<p>Hi Guys! <br />I wanted to know if there is a method or an event that tells me exactly when the map is loaded or completely drawn on the map,<br />the problem is that on my pc it takes 1 second for example, but on my cell phone it takes 3 seconds, what I need to do is<br />once fully loaded instantiate markers and do route calculations. I&#039;m using a google custom provider and the map is based on<br />textures. TY!</p>]]></content>
			<author>
				<name><![CDATA[ppizarro]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=553</uri>
			</author>
			<updated>2017-10-19T14:21:55Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2934#p2934</id>
		</entry>
</feed>
