Topic: Problem loading overlay

Hi,

I'm doing an application with 2 modes (3D and 2D).
For the 2D, I use OnlineMap, with Online data (GoogleMaps/Terrain).
I also have overlay, that I acces via the script TilesetMapTilerOverlayExample.

When I start the app, it works well for all level of zoom. But as soon as I switch to 3D and back to 2D. Some tiles don't have the overlay anymore at some level of zoom only.
It looks like all the tiles that I've been looking at a certain level of zoom, won't appear in the next switch to 2D.

I don't understand, as I load the scene, everything should load same as a start.

public void ChangeTo2D()
    {
        SceneManager.LoadScene("Map2D", LoadSceneMode.Additive);  }

    public void ChangeTo3D()
    {
        SceneManager.UnloadSceneAsync("Map2D"); }

Re: Problem loading overlay

Hello.

If I understand your code correctly, after LoadScene you have two instances of the map.
But you can only have one instance of the map.
So you need to change the logic of switching between 2D and 3D.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Problem loading overlay

Hum ok, what is the best way to hide a map without creating a new instance when you want it back ?
I tried to SetActive(false) the map, but I have the same result. When I active the object again, the overlay disappear. And I have this error message which seems relative to my overlay floder in resources:

Destroying assets is not permitted to avoid data loss.
If you really want to remove an asset use DestroyImmediate (theObject, true);
UnityEngine.Object:Destroy(Object)
OnlineMapsUtils:Destroy(Object) (at Assets/Infinity Code/Online maps/Scripts/Core/OnlineMapsUtils.cs:367)
OnlineMapsTile:Destroy() (at Assets/Infinity Code/Online maps/Scripts/Tiles/OnlineMapsTile.cs:369)
OnlineMapsRasterTile:Destroy() (at Assets/Infinity Code/Online maps/Scripts/Tiles/OnlineMapsRasterTile.cs:198)
OnlineMapsTile:UnloadUnusedTiles() (at Assets/Infinity Code/Online maps/Scripts/Tiles/OnlineMapsTile.cs:572)
OnlineMaps:CheckBufferComplete() (at Assets/Infinity Code/Online maps/Scripts/OnlineMaps.cs:679)
OnlineMaps:LateUpdate() (at Assets/Infinity Code/Online maps/Scripts/OnlineMaps.cs:999)

Re: Problem loading overlay

You can not just hide the map.
You must destroy it.

Please explain in detail what you want to do and why you need two maps.
In most cases this can be done with a single map.
I will try to explain how to do this.

This is a bug in the example.
The updated script is attached.
The new version of Online Maps will contain this.

Post's attachments

Attachment icon TilesetMapTilerOverlayExample.cs 2.05 kb, 7 downloads since 2019-05-21 

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Problem loading overlay

I think, I managed to do what I wnated.
I have an app, that can display building limitation in Augmented reality. When I am in 3D mode, it's the AR camera with 3D object display on the screen, when I push the `2D` button, it switch to a 2D map that I created using Online Maps, and that can display the same information but as an overlay of the map.

Before it was 2 differents scenes, I just merged the 2 scenes into one, and when I want to switch to 3D, I SetActive(false) the main camera (the one looking at the map) and I activate de AR Camera. This way, the map is not destroyed.