Steps on how I Fix the bug of Score text in Unity.

Suleiman Abdullah
3 min readMay 25


Objective: Fix the bugs in the score text in Unity3d.

Before doing anything let's see the code of UIManager.I want when the game start score to be zero

But When I play Editor it starts with 2 then 1 finally it is set to zero.

The first step Let's go to the UIManager and see If we have changed our code in the start method.

After this let's make sure our text has the right text in our canvas.

In the next step let's see if we call UpdateScore, at the right moment, I have called this in the player script inside the AddPointToPlayer method.

Now let's see if we call this method at the right time, I have called this method when enemy health reaches zero inside the enemy/AI script.

But Enemy’s Damage method is called in the player script when we hit Enemy by using RayCast.

Note: When the game starts I don't shoot at the enemy but the text starts from 2 up to zero.

In this step go to UIManager and use the Visual Studio tool tip<Reference for UpdateScore and expand to see where we call this method.

If you see here we call Update score in the wrong script and there is a variable called _aicount which updates the score every time we enable the enemy of the game.

I was like What, UpdateScore does not relate to Pool Manager, who put it here, and I was like it's Suleiman, myself so I delete it there.

Let's play and see If we fix the bugs.

This is how I fix this bug, see you in the next one.



Suleiman Abdullah

Self taught Unity Developer, who is passion about making games ,and he loves Math For Game Development