Enemy doesn't shoot if shotCounter line is added

If this line is added to the script after Fire() is called, the enemies don’t shoot.

    shotCounter = UnityEngine.Random.Range(minTimeBetweenShots, maxTimeBetweenShots);

If the line is removed, they shoot, but at the framerate (incredibly fast). Console doesn’t give me any errors. Can’t figure it out. Everything seems to be same as Rick’s script.

[SOLUTION]
I had deleted squirly brackets after the if statement.

I’m glad you figured the solution out yourself. :slight_smile:

Next time, please feel free to post your solution as a new answer in your thread, and mark that answer as the solution.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms