- Home /
Question by
FlaxenTurnip · May 07, 2019 at 03:46 PM ·
randomtilesgenerator
Generating platforms one after another
How can I make a tile generator, which can generate one tile, and then another right after it, no matter the position in the x, y and z axis?
Comment
Answer by Magso · May 07, 2019 at 04:19 PM
Instantiate the tile at the previous tile position and translate it across half the width.
//Assign the first tile here.
Transform lastTile;
//function or coroutine.
{
Transform newTile;
newTile = Instantiate(tilePrefab, lastTile.position, lastTile.rotation);
newTile.Translate(lastTile.localScale.x / 2, 0, 0);
lastTile = newTile;
}
Your answer
Follow this Question
Related Questions
Randomly generated number 0 Answers
Random.Range(..) not working 1 Answer
Semi Random Monster Spawner 3 Answers
ArgumentException: RandomRangeInt can only be called from the main thread. 1 Answer
Procedural terrain tiles 0 Answers