<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Know when OnlineMaps fully loaded texture]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=2080&amp;type=atom" />
	<updated>2025-06-05T10:40:52Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=2080</id>
		<entry>
			<title type="html"><![CDATA[Re: Know when OnlineMaps fully loaded texture]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9833#p9833" />
			<content type="html"><![CDATA[<p>Hi.</p><p>Example:<br /></p><div class="codebox"><pre><code>using System.Collections.Generic;
using System.Linq;
using UnityEngine;

namespace InfinityCode.OnlineMapsDemos
{
    public class CheckAllTilesLoaded : MonoBehaviour
    {
        public static bool IsAllTilesLoaded(OnlineMaps map)
        {
            List&lt;OnlineMapsTile&gt; tiles = map.tileManager.tiles;
            return tiles.All(tile =&gt; tile.status != OnlineMapsTileStatus.none &amp;&amp; tile.status != OnlineMapsTileStatus.loading);
        }

        public void OnGUI()
        {
            if (GUILayout.Button(&quot;Check All Tiles Loaded&quot;))
            {
                OnlineMaps map = OnlineMaps.instance;
                bool isLoaded = IsAllTilesLoaded(map);
                Debug.Log(isLoaded ? &quot;All tiles are loaded.&quot; : &quot;Some tiles are still loading.&quot;);
            }
        }
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2025-06-05T10:40:52Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9833#p9833</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Know when OnlineMaps fully loaded texture]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9830#p9830" />
			<content type="html"><![CDATA[<p>Hi Alex,</p><p>I have almost the same issue. I have noticed that OnAllTilesLoaded is safe to take a screenshot but how to know that some tiles will have to be downloaded after changing the map position ? Is there a status somewhere that tells that map is busy just after update position ?</p><p>I just would like to know when map is ready because all tiles have been loaded or because nothing was done due to the short position change.</p><p>Thank you in advance</p><p>Best<br />AG</p>]]></content>
			<author>
				<name><![CDATA[murphyii]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1579</uri>
			</author>
			<updated>2025-06-05T08:41:10Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9830#p9830</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Know when OnlineMaps fully loaded texture]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8827#p8827" />
			<content type="html"><![CDATA[<p>Hi Alex,</p><p>First of all, thank you for taking the time to elaborate the video and script. Very welcome!</p><p>As you suggested, my script was not changing map coordinates drastically, so OnlineMapsTile.OnAllTilesLoaded was not being called. At that point I just take the pictures in OnMapUpdated as it is. It is also valid if I change map provider, so covers everything!</p><p>Thank you!<br />BR.</p>]]></content>
			<author>
				<name><![CDATA[mapseagle]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2392</uri>
			</author>
			<updated>2023-01-17T11:56:30Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8827#p8827</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Know when OnlineMaps fully loaded texture]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8826#p8826" />
			<content type="html"><![CDATA[<p>I made a simple script to test it:<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class TestAllTilesLoaded : MonoBehaviour
{
    private void OnGUI()
    {
        if (GUILayout.Button(&quot;Randomize&quot;))
        {
            double lng = Random.Range(-180f, 180f);
            double lat = Random.Range(-80, 80);
            float zoom = Random.Range(3f, 10f);
            OnlineMaps.instance.SetPositionAndZoom(lng, lat, zoom);
        }
    }

    private void Start()
    {
        OnlineMapsTile.OnAllTilesLoaded += OnAllTilesLoaded;
    }

    private void OnAllTilesLoaded()
    {
        Debug.Log(&quot;OnAllTilesLoaded&quot;);
        OnlineMaps.instance.OnMapUpdated += OnMapUpdated;
    }

    private void OnMapUpdated()
    {
        Debug.Log(&quot;OnMapUpdated&quot;);
        OnlineMaps.instance.OnMapUpdated -= OnMapUpdated;
    }
}</code></pre></div><p>Here is a video of the result:<br /><a href="https://www.dropbox.com/s/gtd6bdee7wlusv3/Online%20Maps%20-%20On%20All%20Tiles%20Loaded.mp4?dl=0">https://www.dropbox.com/s/gtd6bdee7wlus … d.mp4?dl=0</a><br />As you can see the events are being called.</p><p>Maybe in your case you change the location in such a way that you still have all the tiles loaded?!<br />After changing the position, subscribe to OnlineMaps.OnLateUpdateAfter, loop through all the tiles (OnlineMapsTileManager.tiles) and check their status.<br />If all of them are already loaded, then OnAllTilesLoaded will not be called, since nothing was loaded.<br />In this case, you don&#039;t have to wait for this event and can simply perform your actions.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2023-01-16T23:42:32Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8826#p8826</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Know when OnlineMaps fully loaded texture]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8825#p8825" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>Hello.</p><p>OnlineMapsTile.OnAllTilesLoaded is called when all tiles are loaded, but before the map has been redrawn.<br />So when OnAllTilesLoaded is called subscribe to OnlineMaps.OnMapUpdated and take your screenshots in that event.</p></blockquote></div><p>Hi! First of all thank you for answering.</p><p>I tried what you suggested but OnlineMapsTile.OnAllTilesLoaded is not being called when I set up coordinates with&nbsp; m_mapTile.map.SetPositionAndZoom(long, lat, zoom). It only triggers when I change the coordinates drastically through editor.</p><p>Is there any way to force all tiles to load after setting coordinates and zoom?</p><p>Thank you,<br />BR.</p>]]></content>
			<author>
				<name><![CDATA[mapseagle]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2392</uri>
			</author>
			<updated>2023-01-16T14:38:59Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8825#p8825</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Know when OnlineMaps fully loaded texture]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8820#p8820" />
			<content type="html"><![CDATA[<p>Hello.</p><p>OnlineMapsTile.OnAllTilesLoaded is called when all tiles are loaded, but before the map has been redrawn.<br />So when OnAllTilesLoaded is called subscribe to OnlineMaps.OnMapUpdated and take your screenshots in that event.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2023-01-13T12:42:17Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8820#p8820</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Know when OnlineMaps fully loaded texture]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8819#p8819" />
			<content type="html"><![CDATA[<p>Hello,</p><p>I was working on a project that uses Online Maps to load OnlineMaps Tileset given world coordinates to take pictures with Render Cameras setup in my Unity scene.</p><p>My main issue is that I need to wait for the Map texture to be fully loaded (not partially or not loaded with grey colour displayed) and take 3 pictures for different camera rects, but I cannot find the correct event that tells me when the OnlineMaps texture is fully loaded.</p><p>I tried:<br />OnlineMaps.OnMapUpdated<br />OnlineMapsTileManager.OnTileLoaded<br />OnlineMapsTile.OnAllTilesLoaded</p><p>But none served me since they triggered but the texture was not ready. I also tried this solution:<br /><a href="https://infinity-code.com/atlas/online-maps/pages/CheckArcGISTile.html">https://infinity-code.com/atlas/online- … STile.html</a><br />But seems that I am working with a OnlineMaps TileSet, so this is not valid to check full map texture.</p><p>I tried using async methods with unity but sometimes it takes the wrong picture since the map texture loading time may vary.</p><p>Could you please help me on this matter? My purpose is to create some kind of coroutine to&nbsp; check everytime the map texture is fully loaded to take the picture, redraw map, take second picture, redraw,...</p><p>Best regards!</p>]]></content>
			<author>
				<name><![CDATA[mapseagle]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2392</uri>
			</author>
			<updated>2023-01-13T11:53:10Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8819#p8819</id>
		</entry>
</feed>
