Array based floor 3D game flat plane

Hey guys, I’m making a game and would like to have a tile texture based floor.

I have absolutely no idea, I hear a lot of people throwing around the idea of using an array but I have no idea how to get my array of [tile1,til2,tile3] w/e to placing the literal textures in the game.

here’s a gif of what my game is like visually I suppose Imgur: The magic of the Internet

alt text

Any direction to a tutorial that will help with what I want would be great as I don’t expect to get a whole lot of code haha! But I generally just want to be able to change between like grass, dirt, stone, road textures.

Thanks a lot guys! Love the community here.

i dont know if bumping is a thing

im hoping bump is a thing

Instantiate(myObjectArray[0], someVector3,SomeQuaternion); you can put whatever object you want to instantiate in and make the vecotr3 the place you want it instantiated and the quaternion is the objects rotation. hope this helps! http://docs.unity3d.com/ScriptReference/Object.Instantiate.html

1 Answer

1

//Create a List or array, I like lists they are more dynamic.
public List listOfTiles = new List();
//Create how large you want your map to be.
private int numberOfTiles = 10;
//Create an int that you want to use to spawn the tiles.
private int currentTileYouAreSpawning = 0;

private void Start()
{
    for (int x = 0; x < length; x++)
    {
	for (int z = 0; z < length; z++)
	{
	    Instantiate(listOfTiles[currentTileYouAreSpawning], new Vector3(x, 0, z), Quaternion.identity); 
        
	}		 
    }
}

With this list approch you will learn how to spawn random tiles if you wanted to. This is just the most basic of generation but it will lead you to some really cool things.