How to Create a Wave System in Unity (Part 3 — Start New Wave)

Objective: Create an empty game object called web container, make all enemies of the current wave child of this game object and start a new wave when all enemies are destroyed.

In the SpawnManger script I declared an int variable called “_waveCounter” that will be used to know the current wave number. Also defined a get method to access this value from another script.

In the UIManager script I create a SpawnManager variable to get the reference to the spawn manager object (the value is assigned from the inspector) and in the function to show the text we get the value of the _waveCounter to show it in the UI.

Next step is to create an empty object called Wave_Continer that is gonna be used to know all the enemies of the current round.

In the Spawn Manager I declared a variable to get the reference to the wave container. Then create a function to check if _stopSpawn flag is true and if there is no enemies to call the start spawning routine.

In the same script in the spawn enemies routine, I make the new enemy child of the wave container.

And that’s it!!! Now when the player destroys the enemies of the current wave, the spawn manager starts the next one.

--

--

--

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

April Development Update

Reminder to a Teams Channel Using Power Automate Flow

A simple quickstart with Docker and ROS

The Only 2 Widget Apps You Need on The iPhone

Deploy a RingCentral WebHook Service to a Microsoft IIS server

My thirties are turning out to be way better than expected.

Validation with Metaprogramming Decorators in Python — Advanced Python

Upgrade/Migrate Aurora PostgreSQL with Minimal Downtime

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rusben Guzman

Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

More from Medium

Benefits of Prototyping with Cubes

Score Implementation

Game Development: Beginners Prospective

A quick guide to player setup in Unity