Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to make infinite wave spawner?

Discussion in 'Scripting' started by SpyderManToo, Feb 19, 2021.

  1. SpyderManToo

    SpyderManToo

    Joined:
    Dec 8, 2020
    Posts:
    387
    I want to make a 2d top down shooter and im working on wave spawning right now.
    all the tutorials on yt are always ones where you have to manually create every level and i want my game to go on infinitely if the player wants it to. how do i make an infinite wave spawner where i can just adjust the time between waves and have it just add one to the amount of enemies every new wave?
     
  2. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    Learn about lists and how to use random.range, after that it should be a simple matter of putting in a float timer and then having it all spawn in the update function when your timer gets to zero after assigning your prefabs to that list. For more control you'd maybe want to have multiple timers for different gameobjects being spawned in and so on.