Hi all,
I am trying to spawn 4 additional balls whenever 50% of the blocks in a level are destroyed. I am able to spawn multiple balls at random locations when 50% of the blocks are destroyed. But the problem is the spawned balls are not moving anywhere unless the current ball hits those spawned balls.
I even tried to add velocity to the spawned balls to make it move instantly when it is spawned but that also didn’t help out. I am also getting a bunch of errors “Null Reference : Object reference not set to an instance of an object.”
I can’t quite figure out as to why the balls are not moving instantly as they are spawned and also why I am getting the above error. I am posting the relevant script codes. Any help would me much appreciated. Thanks !
Level.cs
// Spawn multiple balls when 50 % of the blocks in a level are destroyed
private double percentageFactorForBallSpawn = 0.50;
private int percentageValueForBallSpawn = 0;
Game Status.cs
Ball.cs (The lines where I am getting the error are 27 and 54)