How do you assign custom materials to your custom mesh?

I have a script to create a custom mesh, a custom material using LWRP’s shader graph. Decided to put them together but it doesn’t seem to work. The cube and the quad next to it looks just fine tho.

Here’s a peak
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
[ExecuteInEditMode]
public class MeshEditor : MonoBehaviour
{
    public Material material;

    List<Transform> verticesTransforms; //three of these transforms so that i can change vertices (per triangle) easily

    Mesh mesh;

    List<Vector3> curr_vertex;  //modify vertices 3 at a time, then add them to the vertices list later
    Vector3Int curr_triangle;  //modify the current triangle then assign to the list later

    public List<Vector3> vertices;
    public List<int> triangles;

//-------------------------------------------------------------------------------------------------------------

    void Start()
    {
        if (!Application.isPlaying)
        {
            mesh = new Mesh();
        }
    }
//-------------------------------------------------------------------------------------------------------------

    void Update()
    {
        if (!Application.isPlaying) //Just need this only to help be build things
        {
            GetComponent<MeshRenderer>().material = material;
            GetComponent<MeshFilter>().mesh = mesh;

//-------------------------------------------------------------------------------------------------------------
            while (verticesTransforms.Count < 3)
            {
                verticesTransforms.Add(null);
            }
            while (verticesTransforms.Count > 3)
            {
                verticesTransforms.RemoveAt(verticesTransforms.Count - 1);
            }
            while (curr_vertex.Count < 3)
            {
                curr_vertex.Add(Vector3.zero);
            }
            while (curr_vertex.Count > 3)
            {
                curr_vertex.RemoveAt(curr_vertex.Count - 1);
            }
//-------------------------------------------------------------------------------------------------------------


            for (int i = 0; i < 3; i++)
            {
                if (i < 3)
                {
                    if (verticesTransforms *!= null)*

{
verticesTransforms*.parent = transform; //nice and organized*
curr_vertex = verticesTransforms*.localPosition; //adjust the vertex by moving the transforms in the editor*
}
else
{
verticesTransforms = new GameObject(“Vertex Transform”).transform; //in case the vertex is missing
}
}

vertices[vertices.Count - 1 - i] = curr_vertex*; //now add the recently-modified current vertex to the list*
//-------------------------------------------------------------------------------------------------------------

if (i == 0)
{
triangles[triangles.Count - 1] = curr_triangle.x;
}
if (i == 1)
{
triangles[triangles.Count - 2] = curr_triangle.x;
}
if (i == 2)
{
triangles[triangles.Count - 1] = curr_triangle.x;
}

//used vector3 for triangle cuz it’s a bit more convenient (for me)
}

//-------------------------------------------------------------------------------------------------------------

mesh.triangles = triangles.ToArray();
mesh.vertices = vertices.ToArray();
mesh.RecalculateNormals();
mesh.name = “custom mesh”;
}
}
}

I don’t see your code generating texture coords anywhere. That way the shader doesn’t know, which part of the texture should it sample, and probably just samples the corner of the texture over the entire mesh. See UVs/texcoords of the mesh