UnitySlippyMap icon indicating copy to clipboard operation
UnitySlippyMap copied to clipboard

Click on markers

Open iracom opened this issue 8 years ago • 1 comments

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<MarkerBehaviour>("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<Renderer>().material.mainTexture = Resources.Load("green_marker") as Texture; markerGO.GetComponent<Renderer>().material.color = new Color(1.0f, 1.0f, 1.0f, 1.0f);

markerGO.AddComponent<Button>().onClick.AddListener(() => OnClick());`

Thank you.

iracom avatar Jul 07 '17 18:07 iracom

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.

jondewoo avatar Sep 01 '17 09:09 jondewoo