Topic: How to draw a line between 2 markers in?

1. I want to draw a line between 2 markers
2. click button add new marker,to draw a line between the marker and last marker.

Re: How to draw a line between 2 markers in?

Hello.

Example:

using System.Collections.Generic;
using UnityEngine;

public class TwoMarkersLine:MonoBehaviour
{
    private List<Vector2> points;

    private void OnGUI()
    {
        if (GUILayout.Button("Add marker"))
        {
            OnlineMapsMarker lastMarker = OnlineMaps.instance.AddMarker(Random.Range(-180f, 180f), Random.Range(-80f, 80f));
            points[1] = lastMarker.position; // Just update the line item in the list
            OnlineMaps.instance.Redraw();
        }
    }

    private void Start()
    {
        OnlineMapsMarker firstMarker = OnlineMaps.instance.AddMarker(Random.Range(-180f, 180f), Random.Range(-80f, 80f));
        OnlineMapsMarker lastMarker = OnlineMaps.instance.AddMarker(Random.Range(-180f, 180f), Random.Range(-80f, 80f));

        points = new List<Vector2>
        {
            firstMarker.position,
            lastMarker.position
        };

        OnlineMapsDrawingLine line = new OnlineMapsDrawingLine(points, Color.red, 3);
        OnlineMaps.instance.AddDrawingElement(line);
    }
}
Kind Regards,
Infinity Code Team

Re: How to draw a line between 2 markers in?

thans,it's work!