I am brand new to unity and C#. I am working with a team to create a video game. I am making the health bar. To show it is working, I am using debug.log to display the message “the health bar is displaying:” and then the number of HP, which I got from getHP that keeps track of the current HP. I have it in fixed update, so it is displaying the message thousands of times. Is there a way I can change it so it will only display once every time there is a change? or what can I add to do this? Here is the part I’m struggling on:
void FixedUpdate()
{
playerhealth.getHP();
Debug.Log(“health bar is displaying” + playerhealth.getHP());
}
,I am brand new to unity and c#. I am working on a team to create a rougelike game. I am working on the health bar for the player. To show that it is working, I am using debug.log to display a message health bar is displaying and then the number of HP. I have the debug.log in the fixed update. So it shows this message thousands of times. Is there a way I can change this? How can I get it so it only displays once each time there is a change in HP.
Here’s my code for the message, getHp is what is used to fetch the current HP :
void FixedUpdate()
{
playerhealth.getHP();
Debug.Log(“health bar is displaying” + playerhealth.getHP());
}