Rewriting one script messed up another script

I finally got my script rewritten and working, though through testing, I’ve encountered some weird anomalies. First, I was only editing my Enemy Spawner script. The original way I wrote it was like this: #pragma strictvar Direction : int = 1;var speed : int = 5;var Enemy_Dron - Pastebin.com, and I managed to rewrite it like this: #pragma strictvar Direction : int = 1;var speed : int = 5;var LastSpawn - Pastebin.com.

However, here are the issues that have arrised since the rewrite.

In the inspector, Enemy Drone Array Length reads 0. It should read 2. The spawner only spawns Enemy Drone 1, instead of randomly 1 or 2 (I’ve currently only got 2 enemies in the array). The player, controlled by my Game Manager script, no longer spawns. Nor does the level increase when the number of ships spawned hit’s 30. Here is my Manager Script: #pragma strictvar TotalShips : int;var ShipsKilled : int;var EnemyDrone1 - Pastebin.com. I never touched the manager script once during my Spawner Script rewrite, and even reset the scripts to make sure they were correct in the inspector. Everything is the same as it was before, apart from the Spawner script rewrite. It’s not producing any errors in the console, and I’m not really sure how to go about debugging this to figure out what is going on.

Perhaps just try using random.range [0,enemyDroneArray.Length]

It might be assigning the value to the array length variable before it is properly initialised.
It’s better to dynamically query the array length size anyway… Gives you more flexibility in case you later decide to add to it further in the game.