How can I edit an object created through Instantiate?

***public class maze : MonoBehaviour {
public GameObject wall;
public GameObject floor1;
public float xsize = 5.0f;
public float ysize = 5.0f;
public float wallLength = 1.0f;
public Vector3 intposition;
private GameObject wallfolder;
public Material floormat;
public GameVar data;
public void CreateWalls()
{

    intposition = new Vector3(-xsize / 2, 0.0f, (-ysize / 2) + (wallLength/2));
    Debug.Log(intposition);
    Vector3 myposition = intposition;
    GameObject tempWall;
    wallfolder = new GameObject();
    wallfolder.name = ("wall folder");
    //for bottom plane
    //for x axis
    for (int i = 0; i < ysize; i++)
    {
        for (int j = 0; j <= xsize; j ++)
        {
            myposition = new Vector3 (intposition.x + (j * wallLength) - wallLength / 2, 0.0f, intposition.z + (i * wallLength) - wallLength / 2);
            tempWall = Instantiate(wall, myposition, Quaternion.identity) as GameObject;
            tempWall.transform.parent = wallfolder.transform;
            
           
        }
    }
    //for y axis
    for (int i = 0; i <= ysize; i++)
    {
        for (int j = 0; j < xsize; j++)
        {
            myposition = new Vector3(intposition.x + (j * wallLength)  , 0.0f, intposition.z + (i * wallLength) - wallLength );
            tempWall = Instantiate(wall, myposition, Quaternion.Euler(0f, 90f, 0f)) as GameObject;
            tempWall.transform.parent = wallfolder.transform;
        }
    }
}***

I made a script that creates a basic room shape through well cell prefabs, however, the prefabs always have no material in the mesh renderer, regardless of whether the prefab has a material. I am quite lost =/ How would I change the material of an object if I don’t have the reference??

Instantiate returns the game object that was instantiated, so getting a handle on its return value will allow you to modify it. In fact, you have already done this (it is called tempWall) and are editing the object that you created with instantiate. Simply change the material on this object (for whatever type of renderer you’re using, SpriteRender, MeshRenderer, etc). You can use “GetComponent” method to get the renderer.