Topic: Marker3d OnClick

I'm having problems getting the OnClick event to fire for 3D Markers.  I've tried the tileset example, adding a cube prefab with the MarkerClickCountExample script attached.  When I test, using N to add 3D markers, they aren't clickable.  At least not for me.  I did make sure the Allow default Marker Events is On.  I've also tested with a 3D marker added to the tileset in Unity Inspector, which would fire the event either. 

Is this a bug?

Thanks.

Mac, Unity 5.5, OnlineMaps 2.5.3.1

Re: Marker3d OnClick

Hello.

I just checked Marker3D.OnClick, and it works well.
Perhaps the problem is that when creating a 3D marker using «N», this marker has no events.

Test script:

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);
    }
}
Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

3 (edited by digitalrock 2017-03-10 13:11:09)

Re: Marker3d OnClick

Thanks Alex.  I will try a new empty project and test again.  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.  If you say it worked, then I'm sure I've probably messed something up.  Thanks for the quick reply!

EDIT: Thanks for the test script too.

Re: Marker3d OnClick

When you create a marker using an inspector, it also has no events.
You can assign events only using a script or Playmaker.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

5 (edited by digitalrock 2017-03-10 13:38:06)

Re: Marker3d OnClick

^^^Oh I see, thanks Alex.




Okay I tested the Tileset scene again (not a new project) just added your script to the tileset game object.  It works great when the 3D marker is added via this script.  That is click map, which then adds a marker, then click marker which on click event removes the marker. 

EDIT...

never mind below:

The only thing that I could get working is when there is a 3D marker added in the unity inspector.  It's a dummy cube because I didn't fill in the prefab slot.  The 1 3D marker has the same settings as the 3D markers added via the script.  The scene starts and the starting marker placed in the center isn't clickable.  Default allow events is turned on.  not a deal breaker because my 3D markers are added at runtime. 

I will add this script to my Unity scene now and test further marker clicking.

Re: Marker3d OnClick

I advise you to add your script on the prefab so every time you insert that its clickable