<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Adding a "OnClick" function to the position GPS marker]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=572&amp;type=atom" />
	<updated>2017-06-15T21:48:45Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=572</id>
		<entry>
			<title type="html"><![CDATA[Re: Adding a "OnClick" function to the position GPS marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2474#p2474" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Example:<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class ClickOnLocationMarker:MonoBehaviour
{
    private void Start()
    {
        OnlineMapsLocationService.instance.OnLocationInited += OnLocationInited;
    }

    private void OnLocationInited()
    {
        // Delay because the marker is created after OnLocationInited.
        // We&#039;ll fix this in the next version.
        OnlineMaps.instance.OnUpdateLate += OnUpdateLate;
    }

    private void OnUpdateLate()
    {
        OnlineMaps.instance.OnUpdateLate -= OnUpdateLate;
        if (OnlineMapsLocationService.marker != null) OnlineMapsLocationService.marker.OnClick += OnMarkerClick;
    }

    private void OnMarkerClick(OnlineMapsMarkerBase marker)
    {
        Debug.Log(marker.position.ToString(&quot;F4&quot;));
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-06-15T21:48:45Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2474#p2474</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Adding a "OnClick" function to the position GPS marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2472#p2472" />
			<content type="html"><![CDATA[<p>Hi everyone,</p><p>Everything is pretty much in the title, I have a Map with a OnlineMapsLocationService Script. This script displays a 2D marker at the user&#039;s position.</p><p>How can I make this marker clickable ? <br />Thank you,</p><p>Quentin</p>]]></content>
			<author>
				<name><![CDATA[qlemee]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=114</uri>
			</author>
			<updated>2017-06-15T13:51:50Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2472#p2472</id>
		</entry>
</feed>
