jondewoo / UnitySlippyMap

A slippy map implementation written in C# for Unity3D
304 stars 110 forks source link

Click on markers #32

Open iracom opened 7 years ago

iracom commented 7 years ago

Hello.

Is ther a way to click or touch in markers? I would like to add a listener to the markers to open a screen with the information of a place. But i don't know how do this. I add a listener, but it never get the action.

`GameObject markerGO = Instantiate(go) as GameObject; map.CreateMarker("Point", map.CenterWGS84, markerGO); MapInput.lat = map.CenterWGS84[0]; MapInput.lon = map.CenterWGS84[1]; double[] point = new double[2]; point[0] = map.CenterWGS84[0]; point[1] = map.CenterWGS84[1]; MapInput.sitios.Add(point);

markerGO.GetComponent().material.mainTexture = Resources.Load("green_marker") as Texture; markerGO.GetComponent().material.color = new Color(1.0f, 1.0f, 1.0f, 1.0f);

markerGO.AddComponent

jondewoo commented 7 years ago

Markers are not GUI objects, thus your approach won't work.

Clicks/taps should probably be handled in the MapInput class that would pass the events to the map, and in turn to the user or to the markers and then to the user.