<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Marker3d OnClick]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=455&amp;type=atom" />
	<updated>2017-03-10T21:45:34Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=455</id>
		<entry>
			<title type="html"><![CDATA[Re: Marker3d OnClick]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1980#p1980" />
			<content type="html"><![CDATA[<p>I advise you to add your script on the prefab so every time you insert that its clickable</p>]]></content>
			<author>
				<name><![CDATA[valerio.paventi]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=367</uri>
			</author>
			<updated>2017-03-10T21:45:34Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1980#p1980</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Marker3d OnClick]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1963#p1963" />
			<content type="html"><![CDATA[<p>^^^Oh I see, thanks Alex.</p><br /><br /><br /><p>Okay I tested the Tileset scene again (not a new project) just added your script to the tileset game object.&nbsp; It works great when the 3D marker is added via this script.&nbsp; That is click map, which then adds a marker, then click marker which on click event removes the marker.&nbsp; </p><p>EDIT...</p><p>never mind below:</p><p>The only thing that I could get working is when there is a 3D marker added in the unity inspector.&nbsp; It&#039;s a dummy cube because I didn&#039;t fill in the prefab slot.&nbsp; The 1 3D marker has the same settings as the 3D markers added via the script.&nbsp; The scene starts and the starting marker placed in the center isn&#039;t clickable.&nbsp; Default allow events is turned on.&nbsp; not a deal breaker because my 3D markers are added at runtime.&nbsp; </p><p>I will add this script to my Unity scene now and test further marker clicking.</p>]]></content>
			<author>
				<name><![CDATA[digitalrock]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=308</uri>
			</author>
			<updated>2017-03-10T13:37:07Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1963#p1963</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Marker3d OnClick]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1962#p1962" />
			<content type="html"><![CDATA[<p>When you create a marker using an inspector, it also has no events.<br />You can assign events only using a script or Playmaker.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-03-10T13:13:39Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1962#p1962</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Marker3d OnClick]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1961#p1961" />
			<content type="html"><![CDATA[<p>Thanks Alex.&nbsp; I will try a new empty project and test again.&nbsp; Like I said in the last sentence above though, I did add a 3D marker manually to the tileset in the inspector and then test, which also failed.&nbsp; If you say it worked, then I&#039;m sure I&#039;ve probably messed something up.&nbsp; Thanks for the quick reply!</p><p>EDIT: Thanks for the test script too.</p>]]></content>
			<author>
				<name><![CDATA[digitalrock]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=308</uri>
			</author>
			<updated>2017-03-10T13:10:35Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1961#p1961</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Marker3d OnClick]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1959#p1959" />
			<content type="html"><![CDATA[<p>Hello.</p><p>I just checked Marker3D.OnClick, and it works well.<br />Perhaps the problem is that when creating a 3D marker using «N», this marker has no events.</p><p>Test script:<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class AddAndRemove3DMarkersExample : MonoBehaviour
{
    private bool isMarkerClick = false;
    private OnlineMapsControlBase3D control;

    private void Start()
    {
        control = OnlineMapsControlBase3D.instance;
        control.OnMapClick += OnMapClick;
    }

    private void OnMapClick()
    {
        if (!isMarkerClick)
        {
            OnlineMapsMarker3D marker3D = control.AddMarker3D(control.GetCoords(), null);
            marker3D.OnClick += OnClick;
        }
        isMarkerClick = false;
    }

    private void OnClick(OnlineMapsMarkerBase marker3D)
    {
        isMarkerClick = true;
        control.RemoveMarker3D(marker3D as OnlineMapsMarker3D);
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-03-10T11:02:44Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1959#p1959</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Marker3d OnClick]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1958#p1958" />
			<content type="html"><![CDATA[<p>I&#039;m having problems getting the OnClick event to fire for 3D Markers.&nbsp; I&#039;ve tried the tileset example, adding a cube prefab with the MarkerClickCountExample script attached.&nbsp; When I test, using N to add 3D markers, they aren&#039;t clickable.&nbsp; At least not for me.&nbsp; I did make sure the Allow default Marker Events is On.&nbsp; I&#039;ve also tested with a 3D marker added to the tileset in Unity Inspector, which would fire the event either.&nbsp; </p><p>Is this a bug?</p><p>Thanks.</p><p>Mac, Unity 5.5, OnlineMaps 2.5.3.1</p>]]></content>
			<author>
				<name><![CDATA[digitalrock]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=308</uri>
			</author>
			<updated>2017-03-10T03:37:09Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1958#p1958</id>
		</entry>
</feed>
