Creation of PolygonPath/PolylinePath every frame during immediate drawing leaks Meshes (and memory).
Creating PolygonPath/PolylinePath every frame during immediate drawing such as below leaks Mesh objects (and thus memory).
var polygon = new PolygonPath(); polygon.AddPoint(points[0]); polygon.AddPoint(points[1]); polygon.AddPoint(points[2]); Draw.Polygon(polygon, Color.white);
(No references to polygon instance are retained in the user code).
This is because polygon paths have to be disposed (you can find info on this in the documentation under immediate mode!)
this would be the correct syntax: