Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Click on markers #32

Open
iracom opened this issue Jul 7, 2017 · 1 comment
Open

Click on markers #32

iracom opened this issue Jul 7, 2017 · 1 comment

Comments

@iracom
Copy link

iracom commented Jul 7, 2017

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().onClick.AddListener(() => OnClick());`

Thank you.

@jondewoo
Copy link
Owner

jondewoo commented Sep 1, 2017

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants