Search Unity

Randomly generating platforms?

Discussion in 'Getting Started' started by BlueFireFerrets, Jul 6, 2019.

  1. BlueFireFerrets

    BlueFireFerrets

    Joined:
    Jun 28, 2019
    Posts:
    2
    So I’m making this game where you have to move back and forth to stay on the platform. How do I get the platforms to spawn infinitely based on the ones I have already curated? I need it to be one large platform, followed by a wood plank placed one of 3 places, to the right, to the left, and to the middle. Any help is appreciated, thanks!
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    You would write a script that has a public GameObject variable for the platform prefab, and then some logic in the Update method to Instantiate that prefab as needed, adjusting the new instance's transform.position to put it in the right place.

    Try that, and then post back with a more specific question if you get stuck.
     
    BlueFireFerrets likes this.
  3. BlueFireFerrets

    BlueFireFerrets

    Joined:
    Jun 28, 2019
    Posts:
    2
    Got everything figured out. ^^
     
    JoeStrout likes this.