Help Needed

I am trying to use a minecraft block building system for my game and followed a tutorial for making the world from script using quads. for some reason my void combinequads isnt running. if i move it to the void start it works but im pretty sure that will cause issues. Can anyone look at it and offer advice?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CreateQuads : MonoBehaviour
{
    public Material cubeMaterial;

    enum Cubeside { BOTTOM, TOP, LEFT, RIGHT, FRONT, BACK };

    void CreateQuad(Cubeside side)
    {
        Mesh mesh = new Mesh();
        mesh.name = "ScriptedMesh" + side.ToString();

        Vector3[] vertices = new Vector3[4];
        Vector3[] normals = new Vector3[4];
        Vector2[] uvs = new Vector2[4];
        int[] triangles = new int[6];

        //all possible UVs
        Vector2 uv00 = new Vector2(0f, 0f);
        Vector2 uv10 = new Vector2(1f, 0f);
        Vector2 uv01 = new Vector2(0f, 1f);
        Vector2 uv11 = new Vector2(1f, 1f);

        //all possible vertices
        Vector3 p0 = new Vector3(-0.5f, -0.5f, 0.5f);
        Vector3 p1 = new Vector3(0.5f, -0.5f, 0.5f);
        Vector3 p2 = new Vector3(0.5f, -0.5f, -0.5f);
        Vector3 p3 = new Vector3(-0.5f, -0.5f, -0.5f);
        Vector3 p4 = new Vector3(-0.5f, 0.5f, 0.5f);
        Vector3 p5 = new Vector3(0.5f, 0.5f, 0.5f);
        Vector3 p6 = new Vector3(0.5f, 0.5f, -0.5f);
        Vector3 p7 = new Vector3(-0.5f, 0.5f, -0.5f);

        switch (side)
        {
            case Cubeside.BOTTOM:
                vertices = new Vector3[] { p0, p1, p2, p3 };
                normals = new Vector3[] { Vector3.down, Vector3.down, Vector3.down, Vector3.down };
                uvs = new Vector2[] { uv11, uv01, uv00, uv10 };
                triangles = new int[] { 3, 1, 0, 3, 2, 1 };
                break;

            case Cubeside.TOP:
                vertices = new Vector3[] { p7, p6, p5, p4 };
                normals = new Vector3[] { Vector3.up, Vector3.up, Vector3.up, Vector3.up };
                uvs = new Vector2[] { uv11, uv01, uv00, uv10 };
                triangles = new int[] { 3, 1, 0, 3, 2, 1 };
                break;

            case Cubeside.LEFT:
                vertices = new Vector3[] { p7, p4, p0, p3 };
                normals = new Vector3[] { Vector3.left, Vector3.left, Vector3.left, Vector3.left };
                uvs = new Vector2[] { uv11, uv01, uv00, uv10 };
                triangles = new int[] { 3, 1, 0, 3, 2, 1 };
                break;

            case Cubeside.RIGHT:
                vertices = new Vector3[] { p5, p6, p2, p1 };
                normals = new Vector3[] { Vector3.right, Vector3.right, Vector3.right, Vector3.right };
                uvs = new Vector2[] { uv11, uv01, uv00, uv10 };
                triangles = new int[] { 3, 1, 0, 3, 2, 1 };
                break;

            case Cubeside.FRONT:
                vertices = new Vector3[] { p4, p5, p1, p0 };
                normals = new Vector3[] { Vector3.forward, Vector3.forward, Vector3.forward, Vector3.forward };
                uvs = new Vector2[] { uv11, uv01, uv00, uv10 };
                triangles = new int[] { 3, 1, 0, 3, 2, 1 };
                break;

            case Cubeside.BACK:
                vertices = new Vector3[] { p6, p7, p3, p2 };
                normals = new Vector3[] { Vector3.back, Vector3.back, Vector3.back, Vector3.back };
                uvs = new Vector2[] { uv11, uv01, uv00, uv10 };
                triangles = new int[] { 3, 1, 0, 3, 2, 1 };
                break;
        }


        mesh.vertices = vertices;
        mesh.normals = normals;
        mesh.uv = uvs;
        mesh.triangles = triangles;

        mesh.RecalculateBounds();

        GameObject quad = new GameObject("Quad");
        quad.transform.parent = this.gameObject.transform;
        MeshFilter meshFilter = (MeshFilter)quad.AddComponent(typeof(MeshFilter));
        meshFilter.mesh = mesh;
        MeshRenderer renderer = quad.AddComponent(typeof(MeshRenderer)) as MeshRenderer;
        renderer.material = cubeMaterial;
    }

    void CombineQuads()
    {
        //1. Combine all children meshes
        MeshFilter[] meshFilters = GetComponentsInChildren<MeshFilter>();
        CombineInstance[] combine = new CombineInstance[meshFilters.Length];
        int i = 0;
        while (i < meshFilters.Length)
        {
            combine[I].mesh = meshFilters[I].sharedMesh;
            combine[I].transform = meshFilters[I].transform.localToWorldMatrix;
            i++;
        }
        //2. Create new mesh on parent object
        MeshFilter mf = (MeshFilter) this.gameObject.AddComponent(typeof(MeshFilter));
        mf.mesh = new Mesh();

        //3. Add combined meshes on children as the parent's mesh
        mf.mesh.CombineMeshes(combine);

        //4. Create a renderer for the parent
        MeshRenderer renderer = this.gameObject.AddComponent(typeof(MeshRenderer)) as MeshRenderer;
        renderer.material = cubeMaterial;

        //5. Delete all uncombined children
        foreach (Transform quad in this.transform)
        {
            Destroy(quad.gameObject);
        }
    }

    void CreateCube()
    {
        CreateQuad(Cubeside.FRONT);
        CreateQuad(Cubeside.BACK);
        CreateQuad(Cubeside.TOP);
        CreateQuad(Cubeside.BOTTOM);
        CreateQuad(Cubeside.LEFT);
        CreateQuad(Cubeside.RIGHT);
    }
    // Start is called before the first frame update
    void Start()
    {
        CreateCube();
        CombineQuads(); //not shown in video but working right now, likely to cause issues
    }

    // Update is called once per frame
    void Update()
    {
       
    }

}[code][/I][/I][/I][/I]

Use code tags. When do you want it to run / what should cause it to run?

I dont think code tags will work if i understand them corretly. But maybe just telling it to run after createquads runs would work? If i understand things correctly it shouldnt it automatically run right after?

Code tags are a feature on these forums to make your code more readable on the forums. See https://discussions.unity.com/t/481379 .

Code will only run if it is called explicitly from other code. Start() runs because the Unity game engine calls it. Your CombineQuads() method will only run if you call it from somewhere, for example, Start().

Thank you ill make sure to use code tags next time. Im not understanding why i need to call it when the person in the tutorial didnt have to do the same, i ran into a similar issue from a differnt tutorial. Im trying to find out how to tell it to run after createquad but im not sure how. Im only a couple days into coding anything.

We neither, because you don’t use code tags, so unfortunately we can’t read your code. Please go back and edit your post. You can click on the edit link at the bottom of your post. Here you can find out how to use code tags:
https://discussions.unity.com/t/481379

Ok i got them added sorry i didnt realize it wasnt showing up

Or you just missed it somewhere?
Unity calls these : Awake(), Start() once at startup and Update, FixedUpdate and LateUpdate in every frame. Automagically (we call them magic methods for this sad reason). There are many other magic methods like OnEnable, OnDisable, etc.
If you call a method like that, Unity will call them, so you won’t see explicit method call for them.
But f you name your method something random like that, you need to call it from somewhere. Maybe it is called from another script.
Recheck the tutorial, it has to be there somewhere. We, here, cannot determinate where and how. We didn’t see that tutorial.

Ive watched this thing so many times looking for what i missed im just not seeing it.