Pseudo code for creating grid in unity

Hello all,

i am a unity game developer,and i m pretty bad with the grids.
i have to create a prototype for cube movement in a grid.
but i don’t know how to create a grid.
any thing like pseudo code or algorithm for creating a grid in unity will be very much helpful for me.

Thanks in Advance!
Niki.j

This one works

public var plane : Transform;
public var gridSize : Vector3 = Vector3(4,0,4);
private var canCreateGrid : boolean = true;



function Update () 
{

	if (Input.GetKeyDown(KeyCode.Return)  canCreateGrid)
	{
		canCreateGrid = false;
		CreateGrid();		
	}
	
	
	
	if (Input.GetKeyDown(KeyCode.Delete))
	{
		var clones = GameObject.FindGameObjectsWithTag ("PlanePrefab");
	    
		    for (var clone in clones)
		    {
		        Destroy(clone);
		    }
	    
	    canCreateGrid = true;
	    
    }

}

function CreateGrid () 
{

	for (var x = 0; x < gridSize.x; x++)
	{
		for (var z = 0; z < gridSize.z; z++)
		{
			Instantiate (plane, Vector3(x * 10, 0, z * 10), Quaternion.identity);
		}		
	}
		

}

Hello all,

i got some solution,but it creates objects,it does not look like a grid.
can any one help me o change my code for the grid.

here is my code:

1120973–42281–$GridManager.cs (2.57 KB)

hello Willimsenzo,

thanks for your help,i haven’t tried the code.
but i will definitely check it and let you know the feedback,

Thank you so much for your concern.

Niki.j