Hello there, I’ve looked around on Google and Unity Answers but nothing was quite right so I wanted to share my piece. Basically I’m making a sort of 3rd person space invaders game that’s set in the past and I have different enemy types. Each enemy needs to be limited per level, this is how it looks for each individual level script for the enemy spawn:
using UnityEngine;using System.Collections;using System.Collections.Generic; - Pastebin.com - My apologies I don’t know how to format the code on the website, it just placed it in a unreadable manner.
As you can see there is a lot of repeating code with slight changes which isn’t good practice and I wouldn’t want my code this way. Also the spawning isn’t working as some of the logic must be wrong at the moment. If anyone can help me out to write this in a more clear and concise way. I need to limit the number of enemies spawned on each level by checking if the maximum spawn limit is reached.