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 ?