Alex,
As per your suggestion, I created a specific set of Map variables and assigned the Map GO to them:
[Header("Online Maps Vars")]
public OnlineMaps onlineMaps;
public OnlineMapsControlBase onlineMapsControlBase;
public OnlineMapsCameraOrbit onlineMapsCameraOrbit;
public OnlineMapsBuildings onlineMapsBuildings;
public OnlineMapsProvider onlineMapsProvider;
public OnlineMapsLocationService onlineMapsLocationService;
public OnlineMapsMarkerManager onlineMapsMarkerManager;
public OnlineMapsMarkerBase onlineMapsMarkerBase;
In my manage marker script, I declared the marker:
private OnlineMapsMarker userMarker;
Then in the same script I create the marker in the Start method but it does not allow me to use the variable I created for the OnlineMapsMarkerManager so I'm not sure if that causes and issues and one of the reasons the marker is not auto moving:
private void Start()
{
// Create a new marker.
userMarker = OnlineMapsMarkerManager.CreateItem(new Vector2(0, 0), null, "Your Location");
// Get instance of LocationService.
//OnlineMapsLocationService locationService = OnlineMapsLocationService.instance;
if (GlobalVariables.Instance.onlineMapsLocationService == null)
{
Debug.LogError(
"Location Service not found.\nAdd Location Service Component (Component / Infinity Code / Online Maps / Plugins / Location Service).");
return;
}
// Subscribe to the change location event.
GlobalVariables.Instance.onlineMapsLocationService.OnLocationChanged += OnLocationChanged;
}
// Get Loc info when the location has changed
private void OnLocationChanged(Vector2 position)
{
// Change the position of the marker.
userMarker.position = position;
// Redraw map.
GlobalVariables.Instance.onlineMaps.Redraw();
}
Does the OnLocationChanged always get called or do I need something in an Update method?