mapbox-unity-sdk icon indicating copy to clipboard operation
mapbox-unity-sdk copied to clipboard

Add ability to preview a map at design time.

Open david-rhodes opened this issue 9 years ago • 14 comments

It should be possible to preview a map at design time.

david-rhodes avatar Jun 02 '17 22:06 david-rhodes

Seconded. Also, if we can carry the map from editor to runtime, there are benefits of being able to Ray cast without waiting for the map to be initialised.

Spaxe avatar Jun 02 '17 22:06 Spaxe

Out of curiosity, what would be involved in supporting that? I tried to adapt https://unity3d.college/2017/05/29/real-maps-in-unity3d-with-mapbox/ to work with the tutorial code (https://www.mapbox.com/help/unity-mesh-pt-1/), but no luck. I ended up adding a GenerateMap context menu to AbstractMap. I'm likely completely off track here.

I'm particularly interested in this feature since it's kind of blocking me on a project I'm trying to implement. Basically I'm trying to model the main st of my city in Unity so that people can virtuall walk around and see what proposed projects are going to look like when they are built.

Any help appreciated, and in the event I do manage to get something working I'll obviously share it here.

colin-young avatar Jun 11 '17 00:06 colin-young

Hey all, thanks for showing interest in this feature. Just a heads up that previewing and "saving" a map are different things (we have to consider the Mapbox ToS in developing this feature). Anyway, this seems like a popular and useful feature, so let me speak with the team and see what we can do (I don't expect this to be too difficult, but you never know with Unity editor persistence :smirk:).

david-rhodes avatar Jun 16 '17 21:06 david-rhodes

At this point I'd be happy just being able to preview so I can place buildings. I don't expect the generated terrain would change much between editing and running, so I don't really need to be able to save the terrain, although that would be a bonus. I'll be happy to test out any updates.

colin-young avatar Jun 17 '17 00:06 colin-young

Yes! I'd love to be able to generate map meshes that I can play with in Scene View!

gabrieljbaker avatar Jun 18 '17 21:06 gabrieljbaker

@Spaxe has there action on this item? Specifically, is it compatible with the Mapbox TOS and something we can expect to see at some point, or should this issue be closed if it's something that can't/won't be implemented?

I've been able to get around some of the challenges with a MapMover class that adjusts the local map coördinates and a building adjuster I use in conjunction with a canvas display of offsets that I can use post-run to tweak locations, but it is, at best, awkward. And now I'm at the point where I'd like to start generating roads, so things are going to get a lot more complicated quickly.

colin-young avatar Oct 25 '17 12:10 colin-young

@colin-young I'll answer this since I think you mentioned the wrong person.

We still want to add this type of functionality. I can't give any specifics for when a first iteration will be available, but I think we'll have something before end of year. Right now, we're trying to determine what a minimum feature spec looks like. You have any thoughts on this matter?

david-rhodes avatar Oct 25 '17 19:10 david-rhodes

@david-rhodes I'm going to go ahead and blame fat fingers and a tiny tablet for mentioning the wrong person...

For me a minimum feature spec would be:

  1. being able to see the terrain and imagery in the editor as it will appear at runtime - e.g. I have a AbstractTileProvider implementation and I've defined 4 tiles in each direction in the editor, and my AbstractMap implementation uses the CityMap visualizer, so so that's what I'd see in the editor, possibly at a lower resolution assuming that would increase performance
  2. ability to place objects on terrain (probably a given from point 1)

Future features:

  • additional layers (roads, land use, etc) available in the editor

A nice to have (but probably a totally separate feature and maybe some TOS conflicts) would be the ability to cache everything offline so it would be possible to package everything into a build that didn't require an internet connection. My end goal is to somehow jam MapBox and https://github.com/MicroGSD/RoadArchitect together to create a road network and be able to place buildings on top of the generated roads and sidewalks.

colin-young avatar Oct 26 '17 02:10 colin-young

@colin-young Thank you for the feedback. I think we could make 1 and 2 available.

That said, I'll link our ToS for reference: https://www.mapbox.com/tos/#maps. 😉

david-rhodes avatar Oct 26 '17 16:10 david-rhodes

As I learn more about MapBox and Unity I'll probably be able to contribute more detailed ideas, especially once I figure out the different data layers and the "shape" of the data they provide.

Now I need to get back to figuring out how to fully utilise MapBox Studio, and un-breaking my Unity project after the 1.2 SDK update.

Thanks!

colin-young avatar Oct 26 '17 17:10 colin-young

Any news on this ?

tomh4 avatar Jul 04 '18 16:07 tomh4

I've found that if I add [ExecuteInEditMode] to AbstractMap.cs (e.g. right before: public class AbstractMap : MonoBehaviour, IMap )

that it kinda/sorta accomplishes this? The console spams a lot of error messages like: "Instantiating material due to calling renderer.material during edit mode. This will leak materials into the scene. You most likely want to use renderer.sharedMaterial instead." and "Instantiating mesh due to calling MeshFilter.mesh during edit mode. This will leak meshes. Please use MeshFilter.sharedMesh instead."

but other than that, seems to accomplish the goal of having the terrain/imagery present at edit time. Is this an ok approach, or am I missing something?

stevenpclark avatar Oct 12 '18 16:10 stevenpclark

@stevenpclark Preview at design time is not yet supported. We are working on it and will be supporting it in future releases.

abhishektrip avatar Oct 12 '18 17:10 abhishektrip

This will be in the next release

jordy-isaac avatar Jan 15 '19 22:01 jordy-isaac