Okay, so I’m currently working on a project in which I need to be able to randomly spawn certain objects in to the world. Currently, I’m working on ships. Basically, I want to be able to ‘unlock’ new ships, from separate arrays over time. Here’s an example of what I mean. It’s a snippet of code from the main spawning script that I’m working on.
public GameObject[] currentShips;
public GameObject[] starterShips;
public GameObject[] advancedShips;
public GameObject[] endShips;
private int randomShip;
void FixedUpdate () {
if (time >= 60) {
currentShips = starterShips, advancedShips;
if (time >= 180){
currentShips = starterShips, advancedShips, endShips;
}
}
Now, at the end there, you’ll see that I’ve tried to declare an array as multiple others with a comma. Of course, this didn’t work. So, how can I achieve this? currentShips is used later on to actually spawn a ship, picked at random from the currentShips.
Thanks in advance.