I am creating a map based experience in Unity. I want to add a 3D buildings layer to the map. It is a location based game, so I need there to be 3D buildings wherever a user is in the world. I found this scene layer but I am getting errors when I add it to the layer like this
ArcGISBuildingSceneLayer buildingSceneLayer = new ArcGISBuildingSceneLayer(
"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_Buildings_v1/SceneServer", APIKey);
map.Layers.Add(buildingSceneLayer);
The error is 'invalid json'.
Question 1: how do I add basic 3D buildings to the map wherever in the world a user is located?
Question 2: If I wanted to alter the appearance of these buildings (ie. make them shorter or make the top half of the buildings fade into the air (transparent)), how would I go about doing this?
Solved! Go to Solution.
We just started to support OSM layers in version 1.5. Any versions earlier than that will not work. If you have 1.4 or below, you could update it to the latest version. The current release package can be found here.
It seems that is the incorrect layer type. Please make sure the layer type is a 3DObjectSceneLayer instead of a BuildingSceneLayer. And also be sure you are in Global mode.
So it would be:
var buildingLayer = new Esri.GameEngine.Layers.ArcGIS3DObjectSceneLayer("https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_Buildings_v1/SceneServer", "Building Layer", 1.0f, true, "");
map.Layers.Add(buildingLayer);
If you want to make the building transparent as a whole, you can try the example below:
buildingLayer.Opacity = 0.5f;
But I don't think you can alter the individual appearance/height of these buildings.
Hope that helps!
Thanks for responding, @and1! I have altered my code to use the type you suggested and also changed the map type to global. I am getting a different error this time. It's
"ArcGISLayerViewState Building Layer changed to : Error (Layer type is not supported.)
Additional info: Error processing service metadata response.
Unsupported scene layer version
UnityEngine.Debug:Log (object)"
Hi @AndrewMcLane , what version of the ArcGIS Maps SDK plugin are you currently using for this project?
We just started to support OSM layers in version 1.5. Any versions earlier than that will not work. If you have 1.4 or below, you could update it to the latest version. The current release package can be found here.
Yes! Thank you. This resolved it.
This is also part of the solution, @and1 ! Thank you!