Topic: Access a marker by one of it's component and remove it

Hi,

I'm trying to remove some markers using OnlineMaps.RemoveMarker(OnlineMapsMarker marker)

The thing is, i don't have a reference of the marker i want to remove, but a reference of one of it's component.

public Waypoint[] waypoints; //Waypoint is a c# script that is attached to a marker 3D
for (int i = 0; i < waypoints.Length; i++)
        {
            //Destroy(waypoints[i].gameObject);   // FAIL -> the marker is not destroyed
            map.RemoveMarker((OnlineMapsMarker)waypoints[i].gameObject.GetComponent<OnlineMapsMarker3DInstance>().marker); //this compile but fail while running with error : "Cannot cast from source type to destination type."
        }

I tried several different formula to remove the markers but can't find a working solution. How to remove a marker by it's instance ?

Re: Access a marker by one of it's component and remove it

Hello.

To remove the 3D marker, use OnlineMapsControlBase3D.RemoveMarker3D.
http://infinity-code.com/doxygen/online … 46c15d2eae

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Access a marker by one of it's component and remove it

OnlineMapsControlBase3D.instance.RemoveMarker3D((OnlineMapsMarker3D)waypoints[i].gameObject.GetComponent<OnlineMapsMarker3DInstance>().marker);

It's working, thanks big_smile