Topic: Map Update Finished Callback ?
Is there a Callback when the Map has completed it's update e.g. all tiles have received their coresponding texture (and no gray spots left) ?
You are not logged in. Please login or register.
Infinity Code Forum → Online Maps Help → Map Update Finished Callback ?
Is there a Callback when the Map has completed it's update e.g. all tiles have received their coresponding texture (and no gray spots left) ?
Hello.
Something like that:
using System;
using UnityEngine;
public class CheckMapCompleteLoaded:MonoBehaviour
{
public static Action OnMapCompleteLoaded;
private void Start()
{
OnMapCompleteLoaded += () => Debug.Log("Complete Loaded");
OnlineMaps.instance.OnMapUpdated += OnMapUpdated;
}
private void OnMapUpdated()
{
lock (OnlineMapsTile.tiles)
{
if (OnlineMapsTile.tiles.Count == 0) return;
foreach (OnlineMapsTile t in OnlineMapsTile.tiles)
{
// Check tile status
// If status == loading or status == none (not started), then wait more
if (t.status == OnlineMapsTileStatus.loading || t.status == OnlineMapsTileStatus.none) return;
}
}
OnlineMaps.instance.OnMapUpdated -= OnMapUpdated;
if (OnMapCompleteLoaded != null) OnMapCompleteLoaded();
Destroy(this);
}
}
Is this code still what should be used? I was using OnMapUpdated, but it's getting called multiple times. OnMapCompleteLoaded doesn't appear to be in the current version.
This code is still working.
But in Online Maps v2.5.14+ it's easier to use OnlineMapsTile.OnAllTilesLoaded.
Infinity Code Forum → Online Maps Help → Map Update Finished Callback ?
Powered by PunBB, supported by Informer Technologies, Inc.