Skip to content

Commit

Permalink
Fixed tile provider not loading tiles in editor after playing
Browse files Browse the repository at this point in the history
  • Loading branch information
Victorma committed Oct 10, 2019
1 parent ca2f138 commit a4dd7c5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Assets/uAdventureGeo/Scripts/Map/TileProvider/TileProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static TileProvider Instance
private readonly List<ITileMeta> publicMeta;
private ITileMeta[] publicMetaArray;
private static Dictionary<ITileMeta, Dictionary<Vector3d, ITilePromise>> tileCache;
private bool previousPlayingState = false;

// ##################################
#endregion
Expand Down Expand Up @@ -109,6 +110,12 @@ public ITilePromise GetTile(Vector3d tile, Action<ITilePromise> callback)

public ITilePromise GetTile(Vector3d tile, ITileMeta tileMeta, Action<ITilePromise> callback)
{
if(previousPlayingState != Application.isPlaying)
{
tileCache.Clear();
previousPlayingState = Application.isPlaying;
}

if (!tileCache.ContainsKey(tileMeta))
{
tileCache[tileMeta] = new Dictionary<Vector3d, ITilePromise>();
Expand Down

0 comments on commit a4dd7c5

Please sign in to comment.