HEALTH BAR Unity UI Tutorial (Beginner Friendly)

HEALTH BAR Unity UI Tutorial (Beginner Friendly)

BMo

4 года назад

41,369 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@BMoDev
@BMoDev - 20.11.2019 06:03

It may not look stunning, but you can create a working health bar in less than 5 minutes! Not bad

Ответить
@Zaddy.Griff.
@Zaddy.Griff. - 11.01.2024 03:39

im gettting error code cs0246 on the line that says "public PlayerHealth playerHealth" anyone know how to fix this?

hoping i get a fast reply cause this was 4 years ago

Ответить
@blackstoriesstudios7464
@blackstoriesstudios7464 - 12.07.2023 13:44

Unity says: The type or namespace name 'slider' could not be found can you pls help me (I like your vids a lot)

Ответить
@aleksandraaleksandra7934
@aleksandraaleksandra7934 - 21.05.2023 20:22

Can someone explain how I can add here that life is increased by taking a boost? The video from this channel on this topic did not help me, and I'm tired for another hour and still something is wrong.
I'm trying to do something like:
if the player touches an object with a booster tag, slider +1. But there is a mistake somewhere in my thinking.

Ответить
@aleksandraaleksandra7934
@aleksandraaleksandra7934 - 20.05.2023 21:05

Thanks for a great, simple tutorial. I'm making a game and having many different mechanics, scripts, objects, I'm looking for simple solutions to combine everything into one. You did it great!

Ответить
@treblanitram6505
@treblanitram6505 - 14.05.2023 15:16

I'm having a problem, Object Reference not set to an instance of an Object. Send help pls😢.

Ответить
@EvaseWingmanYT
@EvaseWingmanYT - 24.04.2023 14:05

I have a question but I have an object in my game like a floor spike which is supposed to have my player's health bar degenerate a bit of health, do i need to add an onTriggerEnter2D next to it because the floor spikes have the box collider 2D?

Ответить
@his_of_ham
@his_of_ham - 19.03.2023 03:04

Doesn't work.

Edit: Now works but I changed the equation using Math.Lerp to change the answer into a float

Ответить
@ahmed-0775
@ahmed-0775 - 22.01.2023 00:58

Thanks alot!

Ответить
@adrianfelix4518
@adrianfelix4518 - 10.08.2022 05:19

I'm not sure if you'll see this, but hopefully you do. But I'm having a bug where the slider only works properly for max health and nothing else, do you know how to fix this?

Ответить
@justusisbestest4122
@justusisbestest4122 - 02.08.2022 06:35

TY TY TY

Ответить
@lynx9773
@lynx9773 - 25.05.2022 10:56

i can't add the script into the Slider cause it says the script class cannot be found

Ответить
@msingles61
@msingles61 - 10.05.2022 06:45

You're a legend mate, your entire channel makes bringing our ideas to life so easy even when people are just starting out. Keep it up ❤️

Ответить
@clerklyant2983
@clerklyant2983 - 21.03.2022 15:28

this was the only tutorial that worked for me

Ответить
@GamesHub7
@GamesHub7 - 29.01.2022 20:52

I come here now and then just for the fun part in the beginning!

Ответить
@GamesHub7
@GamesHub7 - 26.01.2022 17:05

Come on how can this video be underrated, maybe gamedevs don't like jokes?
(If you have seen a Unity's video where two people try to joke while teaching, gets the same reaction, I feel like gamedevs don't like jokes?)

Ответить
@hasanabdalla7102
@hasanabdalla7102 - 14.11.2021 07:13

I am getting a null reference for the float fillValue please help

Ответить
@mervenurfem8842
@mervenurfem8842 - 23.05.2021 15:59

Thanks!

Ответить
@TheFibrewire
@TheFibrewire - 18.04.2021 17:47

WOW this seems to be more better than using SetMax and Health methods.

Ответить
@aaronm9576
@aaronm9576 - 14.04.2021 01:07

I followed your both tutorials to what you exactly done but when i adjust the health of the player the health bar goes instantly to 0? unsure why

Ответить
@luyolombatha414
@luyolombatha414 - 26.03.2021 01:10

thanks for this, love you brother man

Ответить
@jesseostrander2939
@jesseostrander2939 - 15.03.2021 23:23

thanks for the tutorial, currently trying to use an Image like a face to indicate the remaining hp. but for some reason i am unable to get it working with the hp slider. the slider updates fine but the image doesnt change when hp is < MAXHP. if i could get your help id be most thankful

Ответить
@ryan123k4
@ryan123k4 - 26.02.2021 19:58

pov: Your looking for the script

Ответить
@whitekanyewestthebully1346
@whitekanyewestthebully1346 - 26.02.2021 10:59

What’s the payer script

Ответить
@azizasuleymen7338
@azizasuleymen7338 - 21.02.2021 11:26

Where i can take PlayerHealth script?

Ответить
@rat1155
@rat1155 - 10.02.2021 16:02

Great video!

Ответить
@jamestran376
@jamestran376 - 08.01.2021 02:23

how do you make a health bar that goes down if you collide with something? I'm trying to make this game and I just cant find a way to make my player lose health if it collides with an enemy object. Plz help

Ответить
@gujeshwarideviupadhyay9875
@gujeshwarideviupadhyay9875 - 18.11.2020 12:36

Bro can you make a video for 2020 unity but good video bro keep it up

Ответить
@japstine4458
@japstine4458 - 30.10.2020 01:23

does this video has a next video? i mean how can we reduce the current health bar

Ответить
@japstine4458
@japstine4458 - 27.10.2020 19:11

how did you create the currenthealth?

Ответить
@thecanaeggplant2937
@thecanaeggplant2937 - 22.10.2020 21:02

Please help me i am literally having a pain

Ответить
@thecanaeggplant2937
@thecanaeggplant2937 - 22.10.2020 21:00

İ cant find the player health script, and idont see it on the video

Ответить
@thecanaeggplant2937
@thecanaeggplant2937 - 22.10.2020 20:59

where is the player health script ?

Ответить
@robistefan29
@robistefan29 - 23.09.2020 19:56

how do i make something damgage the player? i watch all the comments tried the solutions you gave them and did not work :(

Ответить
@LION303200
@LION303200 - 05.09.2020 22:39

put the castle is still attacking you even after you died? how to stop them attack when u die?

Ответить
@aadilgoyal4198
@aadilgoyal4198 - 18.08.2020 12:27

This video helped alot. I was searching literally for 2hrs. Thank you for making this video

Ответить
@xuyixz8229
@xuyixz8229 - 03.08.2020 03:06

how can we make the health bar withou the health script thanks for wasting my time

Ответить
@khemziegamer4790
@khemziegamer4790 - 01.08.2020 01:33

U didnt show us the player health script

Ответить
@SneakyTurtle
@SneakyTurtle - 26.07.2020 04:26

gonna waste my time and now show how you made the player health script ? nike

Ответить
@drama.dote_
@drama.dote_ - 21.07.2020 14:16

thanks. it is really helpful.

Ответить
@gravitymilk5251
@gravitymilk5251 - 10.07.2020 04:51

good video thanks

Ответить
@GabeTheYabe
@GabeTheYabe - 01.07.2020 04:18

So I got it to work, but I will like to get it to work whenever an enemy shoots me or collides into me, it reduces my health. I was thinking to add it in this script yet I was getting an error: nullRefrenceException object reference not set to an instance of an object.

public class DestroyByContact : MonoBehaviour
{
public GameObject enemyExplosion;
public GameObject playerExplosion;

public PlayerHealth playerHealth;

public int scoreValue;

private GameController gameController;



private void Start()
{

GameObject gameControllerObject = GameObject.FindWithTag("GameController");
if (gameControllerObject != null)
{
gameController = gameControllerObject.GetComponent<GameController>();
}
else
{
Debug.Log("Cannot find 'GameController' script");
}
}
private void OnTriggerEnter2D(Collider2D other)
{
// Name of the given object that collided with the enemy
var name = other.tag;

// if the name of the tag is the same as to Boundary tag
// return and do nothing
if (name == "Boundary" || name == "Enemy")
{
return;
}

if(enemyExplosion != null)
{
Instantiate(enemyExplosion, this.transform.position, this.transform.rotation);
}

if (name == "Player")
{

Instantiate(playerExplosion, other.transform.position, other.transform.rotation);

gameController.GameOver();

}

gameController.IncrementScore(scoreValue);

Destroy(other.gameObject);
Destroy(this.gameObject);

}
}

Ответить
@lyuboslavnemtsov8417
@lyuboslavnemtsov8417 - 26.06.2020 14:40

It is great indeed,however
if my currenthealth < maxHealth slider is min value
currenthealth > maxHealth slider is max value

how can i fix this

Ответить
@mohammedjawad3075
@mohammedjawad3075 - 20.06.2020 12:34

whats the player script?

Ответить
@moopdoop9942
@moopdoop9942 - 04.06.2020 20:48

i made the player script with everything right, but forgot to make it a float. i spent way too long wondering why it wasnt working. Thanks for the video!

Ответить
@ilgaza615
@ilgaza615 - 27.05.2020 01:43

whats the script for the player health?

Ответить