I have 3 different platforms of various size
Platform one = 1 unit in size
platform two = 2 units in size
Platform one = 3 units in size
I want them to be generated in random order in X direction endlessly with random space (5-8 units) in between them.
*** Can anyone Help me***
Idea described in following pseudocode:
var Platforms; //platform prefabs
var startingPoint = vector3.zero
in Update function:
Select Random platform from Platforms array and make Instance of prefab
var space = random(5,8)
platform.position = startingPoint
startingPoint += platform.size + space //next position
Also you can optimize this algorithm. You can make a pool of predefined platforms and when some platform goes out of the camera you can swap platform`s position instead of using Instantiation each time.