Danii, could you please somehow show how to implement animated sprite to the bar, so maybe the red part is not static but it is glowing instead or smth
Awesome video, as always. I’ve tried so many health bar tutorials and all have the same result. The position I place it in is never the actual place when in game. Any ideas at all? I have the same canvas settings as you
My best advice is make sure you’re placing it where you want in the Canvas, not the Camera. It should automatically sync! and yeah it’s been a few months😅 but hope this helps
I believe that until you answer I will find the solution, but for all others that will come, what is the right way to call PlayerTakeDmg from an Enemy script? BTW, Great TUT!
You are gonna want to do it in a way that doesn't break anything, if you later decide to remove that enemy from your game. 🙂 The way I do that is by running a OnTriggerEnter (or OnCollisionEnter) function in my EnemyBehaviour script, and when it registers hitting the Player I simply reference PlayerTakeDmg inside the collision function. Doing it this way won't throw you any errors later on, if you decide to delete that enemy. But it really depends on how YOUR game is set up, since there are many ways to go about it. This is one method that I like using. 🙂
@@Dani_Krossing Thanks for the fast replay! I used your mana regenerate video to somehow do something like that. I would like your opinion if it's ok to do something like that. I added to the game manager ta [SerializeField] PlayerBehaviour and a public void PlayerTakeDmg method Inside this public method I call _playerBehaviour.PlayerTakeDmg(dmg) And then OnCollisionEnter (of the enemy) I'm calling GameManager.gameManager.PlayerTakeDmg(AttackPower); What do you think, Is this the right way to use the GameManager or should I have something like a new PlayerManager? (I'm still a beginner in Game development)
unity 1.15f.... there is no image option only UIDocument, double clicking canvas zooms in twice then back once. all unity tutorials are for older versions and unity 1.15 seems baad
I keep getting NullReferanceException: Object reference not set to an instance of an object error. This is happening in my health bar script but I think its because the health variable is not passing through.
It means you are trying to reference something in your code, which can’t be found. So either you made a typo in your code, or you forgot to drag something into the inspector, inside Unity. 🙂
@@Dani_Krossing I don't think I forgot to drag something. That said I am not getting any errors in the script but the issue is probably in the Health Bar Script as I am getting this error when I try to access the SetMaxHealth() function and SetCurrentHealth() function in that script in the PlayerBehavior script with GameManager.gameManager._playerUnitHealth.health
Bruh I'm spending hours trying to figure out how to implement this health bar system on an ememy basically this method worthless and a ded end since you don't have a way showing us how. The cross cross through the game manager it's hard to decipher and rewrite what's going on through it not through it.
AMAZING it worked again thanks so much for your videos, they are the best on youtube because you show every step precisely.
Danii, could you please somehow show how to implement animated sprite to the bar, so maybe the red part is not static but it is glowing instead or smth
SO thankful for these videos!!
You always help me a lot...
The dani dev with an upload schedule:
Hello Dani,
At first thank you! You helping me always, But do you have an Link for the Overlay and the heart? they look so good!!!
Nice Tutorial
what is the gamemanager script
i did everything in the tutorial but at the end i just couldn't drag the canvas into the health bar box. Can you please help me with this.
Don't drag the entire canvas into the serialized field. Only the object the HealthBar script is attached to.
Awesome video, as always. I’ve tried so many health bar tutorials and all have the same result. The position I place it in is never the actual place when in game. Any ideas at all? I have the same canvas settings as you
My best advice is make sure you’re placing it where you want in the Canvas, not the Camera. It should automatically sync! and yeah it’s been a few months😅 but hope this helps
I believe that until you answer I will find the solution, but for all others that will come, what is the right way to call PlayerTakeDmg from an Enemy script?
BTW, Great TUT!
You are gonna want to do it in a way that doesn't break anything, if you later decide to remove that enemy from your game. 🙂
The way I do that is by running a OnTriggerEnter (or OnCollisionEnter) function in my EnemyBehaviour script, and when it registers hitting the Player I simply reference PlayerTakeDmg inside the collision function. Doing it this way won't throw you any errors later on, if you decide to delete that enemy.
But it really depends on how YOUR game is set up, since there are many ways to go about it. This is one method that I like using. 🙂
@@Dani_Krossing Thanks for the fast replay!
I used your mana regenerate video to somehow do something like that.
I would like your opinion if it's ok to do something like that.
I added to the game manager ta [SerializeField] PlayerBehaviour and a public void PlayerTakeDmg method
Inside this public method I call _playerBehaviour.PlayerTakeDmg(dmg)
And then OnCollisionEnter (of the enemy) I'm calling GameManager.gameManager.PlayerTakeDmg(AttackPower);
What do you think, Is this the right way to use the GameManager or should I have something like a new PlayerManager?
(I'm still a beginner in Game development)
When I try to add the HealthBar script to the HB_Fill it says “the script class cannot be found.”
Hi, i'm new to this chanell, can you please tell me how can set this to unit script how you are show to the other video? Thanks!!!
How can you change the color of a specific word
unity 1.15f.... there is no image option only UIDocument, double clicking canvas zooms in twice then back once. all unity tutorials are for older versions and unity 1.15 seems baad
I keep getting NullReferanceException: Object reference not set to an instance of an object error. This is happening in my health bar script but I think its because the health variable is not passing through.
I get this same thing, and was wondering if you found out what it was
Same
I am getting a null reference error. Why is that I wonder?
It means you are trying to reference something in your code, which can’t be found. So either you made a typo in your code, or you forgot to drag something into the inspector, inside Unity. 🙂
@@Dani_Krossing I don't think I forgot to drag something. That said I am not getting any errors in the script but the issue is probably in the Health Bar Script as I am getting this error when I try to access the SetMaxHealth() function and SetCurrentHealth() function in that script in the PlayerBehavior script with GameManager.gameManager._playerUnitHealth.health
But how do you make a health bar in real life?
You buy a smartwatch ;)
pls
I'm gonna need more text to understand that comment. 😂
Bruh I'm spending hours trying to figure out how to implement this health bar system on an ememy basically this method worthless and a ded end since you don't have a way showing us how. The cross cross through the game manager it's hard to decipher and rewrite what's going on through it not through it.