Topic: Multi polygon can't Draw
I am using Unity application I try to Draw multi polygon but only show last poly in array
This is my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MPolygon : MonoBehaviour
{
public OnlineMaps map; //
public Texture2D markerTexture;
public List<OnlineMapsMarker> markers = new List<OnlineMapsMarker>();//
public OnlineMapsDrawingPoly polygon;//
public List<OnlineMapsDrawingPoly> Polygon_S = new List<OnlineMapsDrawingPoly>();
public List<Vector2> Polygon_LatLong;
// Start is called before the first frame update
void Start()
{
Vector2 cursorCoords;
// Frist Poly
Polygon_LatLong.Clear();
Polygon_LatLong.Add(new Vector2(58.23256f, 23.59701f));
Polygon_LatLong.Add(new Vector2(58.23246f, 23.59685f));
Polygon_LatLong.Add(new Vector2(58.23221f, 23.59699f));
Polygon_LatLong.Add(new Vector2(58.23231f, 23.59715f));
polygon = new OnlineMapsDrawingPoly(Polygon_LatLong, Color.blue, 2, new Color(1, 1, 1, 0.3f));
OnlineMapsDrawingElementManager.AddItem(polygon);
//Polygon_S.Add(polygon);
//OnlineMapsDrawingElementManager.AddItems(Polygon_S);
///'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
///Second Poly
Polygon_LatLong.Clear();
Polygon_LatLong.Add(new Vector2(58.2326f, 23.59728f));
Polygon_LatLong.Add(new Vector2(58.2326f, 23.59707f));
Polygon_LatLong.Add(new Vector2(58.23256f, 23.59701f));
Polygon_LatLong.Add(new Vector2(58.23231f, 23.59715f));
Polygon_LatLong.Add(new Vector2(58.23231f, 23.59728f));
polygon = new OnlineMapsDrawingPoly(Polygon_LatLong, Color.red, 2, new Color(1, 1, 1, 0.3f));
OnlineMapsDrawingElementManager.AddItem(polygon);
//Polygon_S.Add(polygon);
// //OnlineMapsDrawingElementManager.AddItems(Polygon_S);
Vector2 center = new Vector2(58.2326f, 23.59728f);
int zoom = 10;
OnlineMaps.instance.position = center;
OnlineMaps.instance.zoom = zoom;
}
My code is file attched
Please I need help Guys