using Google.Maps.Coord; using Google.Maps.Event; using Google.Maps.Examples.Shared; using Google.Maps.Feature.Style.Settings; using UnityEngine; namespace Google.Maps.Examples { /// /// This example demonstrates a basic usage of the Maps SDK for Unity with the Lightweight /// Render Pipeline. /// [RequireComponent(typeof(MapsService))] public class URPExample : MonoBehaviour { /// /// Settings used to style regions. /// [Tooltip("Settings used to style regions.")] public RegionStyleSettings RegionStyleSettings; /// /// Settings used to style roads. /// [Tooltip("Settings used to style roads.")] public SegmentStyleSettings RoadStyleSettings; /// /// Settings used to style are water. /// [Tooltip("Settings used to style area water.")] public AreaWaterStyleSettings WaterStyleSettings; /// /// Settings used to style extruded structures. /// [Tooltip("Settings used to style extruded structures.")] public ExtrudedStructureStyleSettings ExtrudedStructureStyleSettings; /// /// Settings used to style modeled structures. /// [Tooltip("Settings used to style modeled structures.")] public ModeledStructureStyleSettings ModeledStructureStyleSettings; /// /// of the initial load position. /// [Tooltip("LatLng to load (must be set before hitting play).")] public LatLng LatLng = new LatLng(40.6892199, -74.044601); /// /// Load range, in meters, of map around above. /// [Tooltip("Map load range in meters.")] public float LoadRange = 500; /// /// Use to load geometry. /// private void Start() { // Get required MapsService component on this GameObject. MapsService mapsService = GetComponent(); // Set real-world location to load. mapsService.InitFloatingOrigin(LatLng); // Configure Map Styling. GameObjectOptions options = new GameObjectOptions(); options.RegionStyle = RegionStyleSettings.Apply(options.RegionStyle); options.SegmentStyle = RoadStyleSettings.Apply(options.SegmentStyle); options.AreaWaterStyle = WaterStyleSettings.Apply(options.AreaWaterStyle); options.ExtrudedStructureStyle = ExtrudedStructureStyleSettings.Apply(options.ExtrudedStructureStyle); options.ModeledStructureStyle = ModeledStructureStyleSettings.Apply(options.ModeledStructureStyle); // Load map with default options. Bounds bounds = new Bounds(Vector3.zero, Vector3.one * LoadRange); mapsService.LoadMap(bounds, options); } } }