Тёмный
No video :(

Three Cool Health Bars in Unity (2022/2020) 

Hyped Cloud
Подписаться 560
Просмотров 59 тыс.
50% 1

This is a Unity tutorial that will show you how to make three different health/mana bar styles. The bars will gradually increase and decrease with color changing.
---------| Related Links 🔗 |---------
✏️ Blog Post: www.HypedCloud...
- Unity Project: drive.google.c...
- Ring Sprite Download: drive.google.c...
---------| Timeline ⏰ |---------
-(🚩) are the main keys.
00:00 - Introduction.
00:10 - Starting Tutorial (First Health Bar). 🚩
03:03 - Making the health bar smoother with colors.
04:09 - Second Health Bar (Ring Health Bar). 🚩
04:40 - Last Health Bar (Health Points Bar). 🚩
06:09 - Ending (Final Result). 🏁
🙋‍♂️ Follow Me:
- Twitter: / hypedcloud
- itch.io: HypedCloud.itc...
🌐 www.HypedCloud...

Опубликовано:

 

17 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 73   
@HypedCloud
@HypedCloud 4 года назад
The audio volume is a little bit low. Sorry about that. Check out the description for links and timeline. 🔗⏰
@Maskeowl
@Maskeowl 2 года назад
create sprite is missing and i download ur ring png but i cant put it image source section
@Maskeowl
@Maskeowl 2 года назад
okey i solve it just changn texture type to 2d uı
@laczikmarton2745
@laczikmarton2745 2 года назад
This is the best health bar tutorial i’ve seen. I’ve worked with sliders previously, but i wasn’t satisfied with that, this is better
@toxicrez1
@toxicrez1 4 месяца назад
I thought i was the only one who wanted smooth bars! Thx so much for this!
@vicentegirardin
@vicentegirardin 3 года назад
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Health : MonoBehaviour { public Text healthText; public Image healthBar; float health, maxHealth = 100; float lerpSpeed; private void Start() { health = maxHealth; } private void Update() { healthText.text = "Health: " + health + "%"; if (health > maxHealth) health = maxHealth; lerpSpeed = 3f * Time.deltaTime; HealthBarFiller(); ColorChanger(); } void HealthBarFiller() { healthBar.fillAmount = Mathf.Lerp(healthBar.fillAmount, health / maxHealth, lerpSpeed); } void ColorChanger() { Color healthColor = Color.Lerp(Color.red, Color.green, (health / maxHealth)); healthBar.color = healthColor; } public void Damage(float damagePoints) { if (health > 0) health -= damagePoints; } public void Heal(float healingPoints) { if (health < maxHealth) health += healingPoints; }
2 года назад
@kikitsunee__
@kikitsunee__ Год назад
@fulgencejuniorlohore854
@fulgencejuniorlohore854 5 месяцев назад
Thanks for this nice tutorial buddy. 2024 and still relevant!
@thomasthetankcat1133
@thomasthetankcat1133 2 года назад
When I started watching the video, my question was answered instantly. After watching more, I realized my question wasn't big enough
@TheCurious36
@TheCurious36 3 года назад
very solid video man, thanks a bunch
@fy8449
@fy8449 2 года назад
Just what I needed.
@GraphicalBoss
@GraphicalBoss 3 года назад
Excellent Job on your video👏👏👏👏
@rachapongwatana3868
@rachapongwatana3868 Год назад
Thank you for sharing a very great idea of very cool Health Bars :)
@narsower
@narsower 2 года назад
Thank you. You helped me how smoothly change image
@GameDesignverse
@GameDesignverse 2 года назад
This is so great !! Thank you so much brother !!
@monsterblues
@monsterblues Год назад
Thanks this was very helpful!
@fc6827
@fc6827 3 года назад
This was amazing, thank you.
@aureliencord5763
@aureliencord5763 3 года назад
Very useful & clear explanation, Thanks !
@techwithkuda8952
@techwithkuda8952 2 года назад
U just earned my sub
@arcanep
@arcanep Год назад
Awesome! :D
@Massive_M
@Massive_M Год назад
You helped me with this video of yours Thanks a lot...
@ormedeo_fucsia
@ormedeo_fucsia 3 года назад
Thank You!
@misal-isahabe5281
@misal-isahabe5281 2 года назад
Thanks for this tutorial, it is so good content!
@SurpriseMotherFaker
@SurpriseMotherFaker 2 года назад
Grate tutorial bro! you should keep making tutorial videos. Liked!
@Nick-rq4gy
@Nick-rq4gy 3 года назад
Excellent, love it
@pyt3z
@pyt3z Год назад
Note: You can't use TMP(Text Mesh Pro) for the text field you should use the old one if you would like for newer version of unity it Legacy.
@Firefox-hw3co
@Firefox-hw3co Год назад
Thank you so much!
@touhidrabbenyshafin8471
@touhidrabbenyshafin8471 2 года назад
Amazing!
@catteixeira18
@catteixeira18 2 года назад
Life saver!
@wratio335
@wratio335 2 года назад
I know I'm late... but for some reason my color changing doesn't transition between colors, and instead changes to the red color as soon as damage is taken. Can anyone help or know why this could be?
@RicardoADev
@RicardoADev Год назад
These were pretty good. A little worried about that for loop in the update method tho...
@BrawlMouse.
@BrawlMouse. Год назад
THANKS YOU VERY MUCH
@guesrt2235
@guesrt2235 2 года назад
Você é monstro!
@tegomlee
@tegomlee 2 года назад
Thank you for this, you’ve gained a sub from me
@sherlockholmes374
@sherlockholmes374 Год назад
I can't apply the text layer to the text frame on the camera :(
@hulick6910
@hulick6910 2 года назад
health bar for Voxel is his skin, it becomes darker as health gets lower, debuffs also affects the color, poison is green, confusion is grey, scared is purple, and bleeding is Voxel leaking cytoplasm while red, Voxel has blue blood.
@dragonballz3686
@dragonballz3686 2 года назад
Dude I have a problem in my game. That is , the player has a script which has a take hit value, that is if the player get hit by enemy bullet it will decrease the value because it is a health bar slider. In that , I've set the value as 1, so that if enemy shoots a bullet it takes 1 damage. But the player gets 2 damage hit. What to do bro. Any suggestions.
@HypedCloud
@HypedCloud 2 года назад
The player might have two colliders making it have a damage for each one. If not, try destroying the bullet when hitting the player before taking the damage. Let me know if it works :)
@dragonballz3686
@dragonballz3686 2 года назад
@@HypedCloud yeah thanks bro
@cinemacat4108
@cinemacat4108 3 года назад
Wow very helpful
@HypedCloud
@HypedCloud 3 года назад
Glad I could help :D
@코코아_Cocoa
@코코아_Cocoa 2 года назад
Thanks :)
@kaorimiyazono2026
@kaorimiyazono2026 3 года назад
thx
@markiavelli
@markiavelli Год назад
Hmm but I can't put my Health Text into the Main Camera Text slot :(.
@markiavelli
@markiavelli Год назад
Also, you can't create a sprite anymore. It's an image now
@ZacharyAghaizu
@ZacharyAghaizu 3 года назад
Nice and Concise!I was having issues applying health/maxhealth with my list.count/maximum. It works when I *0.1 but not /10. Do you know why?
@HypedCloud
@HypedCloud 3 года назад
Hey, sorry for the late reply. Anyway, maybe because your health is an integer and not float? Not really sure. Let me know if you have fixed it already :)
@agoodbambino2181
@agoodbambino2181 3 года назад
Hi, Great tutorial! How can make a health pickup for healing this specific health script?
@Mrazgoodaz
@Mrazgoodaz 3 года назад
When I add damage of 25, instead of it going to .25 it goes to "0.0388175." Something in the Mathf lerp is messing it up.
@HypedCloud
@HypedCloud 3 года назад
Lerp in our case is used to animate the health bar. Don’t decrease the health using lerp. Let me know if you are still struggling; I’ll be happy to help :)
@charlesdelachapelle2113
@charlesdelachapelle2113 2 года назад
Awesome tutorial but i have a problem when i click on the button the health bar doesn't reduce if someone can help me
@Nick-rq4gy
@Nick-rq4gy 3 года назад
Hi great video, can you make tutorial with the health bar being attached to the player, and a 3D enemy attacks at close range and the health bar goes down? I am stuck right now looking for this tutorial online, can you help?
@Lury03
@Lury03 Год назад
i m at the same point right now
@mattthegod6940
@mattthegod6940 3 года назад
Need help, it says “The script don’t inherit a native class that can manage a script “ Anyone knows a fix?
@Lavender34124
@Lavender34124 2 года назад
it says can't add component health cause script class cannot be found
@CryosMC
@CryosMC Год назад
name your script Health with a capital or health
@bunbunmikey7485
@bunbunmikey7485 3 года назад
What if I don't have a main camera? What if I have a follow camera? And what if I want to call the damage points slowly while holding down a key on the keyboard but from another script?
@HypedCloud
@HypedCloud 3 года назад
It doesn’t have to be on the main camera. You can put it on any object as long as it won’t be destroyed (removed/deleted from the scene). The main camera is just an example. You can call the Damage() method from another script by simply typing in an Update() method in the other script: if (Input.GetKey(KeyCode.*yourKey*) { HealthScript.Damage(5f); } There are many other ways to call the damage method from another script that you can find online :) Let me know if you need further help.
@bunbunmikey7485
@bunbunmikey7485 3 года назад
@@HypedCloud Wow! That was really fast! I'll try incorporating it. We got a little car game and I am trying to use this video to make a fuel meter. It might be that I am having troubles because I'm trying to call the functions through an acceleration method.
@HypedCloud
@HypedCloud 3 года назад
@@bunbunmikey7485 Hmmm.. Why don’t you drag the health script to the car, then in the script that has the acceleration method, you just create a new public Health script, then in the inspector, you just have to drag the car to it. public HealthScript health;
@bunbunmikey7485
@bunbunmikey7485 3 года назад
@@HypedCloud I created an empty game object to use as the bar. In the car prefab I add the meter and as I call the function from the carController I create a new bar and use that. Only problem I get now is that the bar turns red before it reaches halfway and as soon as it is below 0.5 the value starts to fluctuate. It goes up and down and get stuck around 0.47 to 0.49. It never hits zero.
@Hurkaaa
@Hurkaaa 3 года назад
Hi! How can I make on collision the HP is lowered by 5? (Sry for the bad eng)
@HypedCloud
@HypedCloud 3 года назад
Hi HGteam, You can use the Damage function in the onCollisionEnter(Collision other) { //check if it’s an enemy for example //then call the Damage function //like so: Damage(5); } NOTE: this will work if both Damage() and onCollisionEnter() are in the same script. However, if you have two different scripts and you want to call Damage(5) from another script you will have to define the Health script in it first: public Health health; then select it from the inspector just like how we did with the buttons. I prefer to use [SerializedField] instead of public (not so important). Anyway, if you are still struggling let me know :)
@Hurkaaa
@Hurkaaa 3 года назад
@@HypedCloud Thanks ^^
@Hurkaaa
@Hurkaaa 3 года назад
@@HypedCloud Erhmmm... Sadly that's not working... If you can help, here's my code: void OnCollisionEnter(Collision other) { GameObject.FindWithTag("enemy"); Damage(5); } (I'm really beginner :D)
@HypedCloud
@HypedCloud 3 года назад
@@Hurkaaa try: if (other.tag == “enemy”) Damage(5);
@Hurkaaa
@Hurkaaa 3 года назад
@@HypedCloud Nope. Not working
@vicentegirardin
@vicentegirardin 3 года назад
how do you create the buttons
@HypedCloud
@HypedCloud 3 года назад
Right click on the hierarchy > Create > UI > Button. Then select the button and add a new “On Click” event and select the Health script from where you attached it to. Then choose which function / method you want to run from the dropdown menu. It is so easy to do. If you are still struggling, this might help you: www.tutorialspoint.com/unity/unity_the_button.htm
@mixedtrigenito
@mixedtrigenito 2 года назад
the audio is holy shit....
@ravenace8485
@ravenace8485 3 месяца назад
the worst thing you can do in a freaking guide is to time lapse, we want to see everything you kinda ruined it for me when you start to time lapse at the buttons , I can't even place my text in the slot of the main camera from within the script, as a new beginner to coding this video is a 4/10 for me.
Далее
How to make a HEALTH BAR in Unity!
21:06
Просмотров 1,1 млн
I Built a Transparent Boomerang (it's lethal)
13:10
Просмотров 3,6 млн
❌Разве такое возможно? #story
01:00
10 Minutes vs. 10 Years of Animation
19:29
Просмотров 834 тыс.
I Tried To Beat Minecraft Backwards
18:53
Просмотров 1,2 млн
They made a game about philosophy...
23:19
Просмотров 404 тыс.
How to make a LOADING BAR in Unity
11:25
Просмотров 741 тыс.
3 Hours vs. 3 Years of Blender
17:44
Просмотров 4,5 млн
I tried Discord Bot Makers...
14:19
Просмотров 117 тыс.