Access x value in list of Vector3

I’ve made a list of all possible x/y coordinates with my map area:

for(int x = 0; x <= worldWidth; x++) 
		{
			for(int y = 0; y <= worldHeight; y++) 
			{
				//makes a list of all possible positions for tiles
				gridPositions.Add(new Vector3(x, y, 0f));
			}
}

I’ve figured how to render a tile at every position, but next I need to apply a dozen more restrictions to create a landscape. To do this I need to access the x and y values of entries in my list, and I know in javascript and it would be something like gridPosition*.x , but I’m unsure how to get it in Unity.*
Thanks!

I think you answered your own question. You will need to declare gridPositions as an array and I usually set the size before hand.

Vector3 gridPositions;

gridPositions = new Vector3[worldHeight];

for(int x = 0; x <= worldWidth; x++) … rest of code

Then to access x value:

tempFloat = gridPosition*.x;*

You’ve called your list gridPositions, so it’s gridPositions_.x, not gridPosition*.x.*_

From your example, gridPositions would appear to be of type Vector3, so you should be able to do as you suggested. “.x” after the Vector3 variable will return the x component as a float. You may want to have a look at the Vector3 scripting reference for this instance.