1 (edited by digitalrock 2017-03-10 14:56:32)

Topic: multiple 3D markers help

Quick question,

Any idea why I get 3 child markers when I'm calling AddMarker 1 time (1 marker is active, the other 2 are disabled)?

I add one (1) 3D marker at runtime and I see this in the hierarchy:

Here's the code:

GameObject pipPrefab = Resources.Load ("marker3D") as GameObject;
if(pipPrefab == null)
          throw new NullReferenceException ("PipMapModelView : LoadMarkers() - Failed to load marker3D prefab");

OnlineMapsMarker3D marker3D = control.AddMarker3D(lon,lat, pipPrefab);

marker3D.OnClick += OnMarkerClick;
Post's attachments

Attachment icon Screen Shot 2017-03-10 at 7.42.33 AM.png 13.73 kb, 294 downloads since 2017-03-10 

Re: multiple 3D markers help

This piece of code looks well.
Please show more code (or the whole script).

Kind Regards,
Infinity Code Team.

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

Re: multiple 3D markers help

Thanks Alex.

I just tried passing null instead of my prefab and I don't get the extra (disabled) marker game objects


OnlineMapsMarker3D marker3D = control.AddMarker3D(lon,lat, null);

4 (edited by digitalrock 2017-03-10 15:10:42)

Re: multiple 3D markers help

I tried a different prefab, one that has no child objects, and it worked too.  So something about my prefab, which has 1 child object, is causing this.

EDIT:  Looks to be specific to my prefab as I tested with another prefab (one with child cube) and it doesn't cause the problem. 

Do you see anything wrong with this (exact code):

// Get the world position for this pip...
double lat = pipInstance.location.coordinates[0];
double lon = pipInstance.location.coordinates[1];

// Get instance of OnlineMapsControlBase3D (Texture or Tileset)

OnlineMapsControlBase3D control = OnlineMapsControlBase3D.instance;

if (control != null)
{
    
    GameObject pipPrefab = Resources.Load ("pip_marker") as GameObject;
    if(pipPrefab == null)
        throw new NullReferenceException ("PipMapModelView : LoadMarkers() - Failed to load pip_marker prefab");

    // Create 3D Pip

    OnlineMapsMarker3D marker3D = control.AddMarker3D(lon,lat, pipPrefab);

    marker3D.OnClick += OnMarkerClick;

    LoadPip(pipInstance, pipPrefab, i, marker3D);

}

Re: multiple 3D markers help

SOLVED:  I see that my testing from last night I added one of your example scripts to test marker click counts!  Sorry about that.