Select to view content in your preferred language

Modifying ArcGISMap Component by C# script doesn't update Component in Inspector

156
0
4 weeks ago
ws4945894
Emerging Contributor

Dear all,

While working on C# scripts to build a scene I noticed that changes made by the script to basemap and elevation settings are not mirrored in the ArcGISMap Component after the script has been run. Functionality is fine, but it's somewhat confusing that the Inspector data in basemap and elevation sections do not change at all.

Thanks and best regards

Winfried

 

My environment:

Windows 11 Pro, Version 23H2

Unity 6 (6000.0.23f1)

ArcGIS Maps SDK for Unity 1.7

 

This is what the Inspector looks like with ArcGISMap GameObject selected.

No basemap and elevation source is disabled.

ws4945894_0-1744883501446.png

Code snippet from C# script

private void CreateArcGISMap()
{
    // Initialize Map

    arcGISMap = new ArcGISMap(arcGISMapComponent.MapType);

    // Set the Basemap

    arcGISMap.Basemap = new ArcGISBasemap(ArcGISBasemapStyle.ArcGISImagery, APIKey);

    // Create the Elevation

    ArcGISImageElevationSource arcGISImageElevationSource = new ArcGISImageElevationSource
               ("https://elevation3d.arcgis.com/arcgis/rest/services/
               WorldElevation3D/Terrain3D/ImageServer", APIKey);

    // Set the Elevation Source Name

    arcGISImageElevationSource.Name = "TestElevation";

    // Enable the Elevation Source

    arcGISImageElevationSource.IsEnabled = true;

    // Assign the Elevation Source to the ArcGISMap

    arcGISMap.Elevation = new ArcGISMapElevation(arcGISImageElevationSource);

After running the C# script everything’s fine. Most importantly basemap and elevation are obviously applied in the Game View window.

ws4945894_1-1744883662809.png

But the Component isn’t updated at all (please see screenshot).

ws4945894_2-1744883694726.png

However, if the elevation is disabled in the C# script like so

arcGISImageElevationSource.IsEnabled = false;

it shows in the scene when the script is run again. So the functionality seems to be fine but the updated values are not shown in the Component itself.

ws4945894_3-1744883778679.png

 

 

0 Kudos
0 Replies