My game is paused whenever I hit play and I can't unpause


this is happening. I have written exactly same code but whenever I click on play the game gets paused and I can’t unpause it . It is throwing an error.

If you look in your Console, you have “Error Pause” selected in the Console. If you uncheck this the game will run normally when you press play.
However, in this case, it’s highlighting an error in your fighter code.

If you look at the error, you’ll see that it says "Object reference not set to an instance of an object RPG.Combat.Fighter.Update()
At a guess, line 20 in the code references target, but target hasn’t been set yet because it is set when the Controller sets a target.

Put this in the beginning of your Update() in Fighter:
if(!target) return;

2 Likes

thank you Brian, you really helped me out.
Im sorry guys but this course is not as good as the others…

Privacy & Terms