Topic: NullRef in OnlineMapsMarker when creating markers
Hello Infinity Code, I am experiencing a problem with the Marker class, and it is causing my map to only display one marker.
NullReferenceException: Object reference not set to an instance of an object
OnlineMapsMarker.Init (System.Nullable`1[T] width, System.Nullable`1[T] height) (at Assets/OnlineMapsV3/Online maps/Scripts/Markers/Instances/OnlineMapsMarker.cs:379)
This is the exact error. I use the following method to create markers with two different filters:
public void PlaceMarkersOnMap(string eventTitleFilter) {
markerManager.RemoveAll();
foreach (MarkerData data in MarkerDataManager.Instance.MarkerData) {
foreach (EventAtLocation eventAL in data.HostedEvents) {
if (eventAL.EventType == mapType) {
if (eventAL.EventTitle == eventTitleFilter) {
markerManager.Create(new Vector2(data.Longitude, data.Latitude),
markers[GetMarkerFromName(eventAL.EventTitle)],
data.UID.ToString());
}
}
}
}
this.gameObject.AddComponent<MarkerTouch>();
}
This is the only method that controls marker creation. Can anyone identify this problem and recommend a solution? Thank you for the help!