Пример #1
0
    public static GameObject CreatePolygonalObject(string name, LayerMask layer, NativeSlice <Vector2> polygons, float width, bool createCollider = true)
    {
        Mesh       mesh = PolygonUtils.CreateMesh(polygons, width);
        GameObject go   = CreateObject(name, layer, mesh);

        if (createCollider)
        {
            go.AddComponent <PolygonCollider2D>().SetPath(0, polygons.ToArray());
        }

        go.layer = layer;
        return(go);
    }