HOW TO MAKE A HEALTH BAR IN UNITY 🎮 | How to Make a Health Bar for Beginners | Learn Unity For Free

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ม.ค. 2025

ความคิดเห็น •

  • @JV-cz7db
    @JV-cz7db ปีที่แล้ว

    AMAZING it worked again thanks so much for your videos, they are the best on youtube because you show every step precisely.

  • @AnastasiKoko
    @AnastasiKoko 2 ปีที่แล้ว +7

    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

  • @marissamoser407
    @marissamoser407 2 ปีที่แล้ว +1

    SO thankful for these videos!!

  • @Shelbyy476
    @Shelbyy476 2 ปีที่แล้ว +1

    You always help me a lot...

  • @TheDuccyGaming
    @TheDuccyGaming ปีที่แล้ว

    The dani dev with an upload schedule:

  • @keanovdbesteham7363
    @keanovdbesteham7363 ปีที่แล้ว +1

    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!!!

  • @royal_striker_6095
    @royal_striker_6095 2 ปีที่แล้ว

    Nice Tutorial

  • @JameNotLame
    @JameNotLame ปีที่แล้ว +2

    what is the gamemanager script

  • @victorverbeke
    @victorverbeke ปีที่แล้ว +1

    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.

    • @sladnam7480
      @sladnam7480 11 หลายเดือนก่อน

      Don't drag the entire canvas into the serialized field. Only the object the HealthBar script is attached to.

  • @phillipwebb1104
    @phillipwebb1104 ปีที่แล้ว

    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

    • @isaacashton5772
      @isaacashton5772 11 หลายเดือนก่อน

      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

  • @OfirHadad
    @OfirHadad 2 ปีที่แล้ว +1

    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!

    • @Dani_Krossing
      @Dani_Krossing  2 ปีที่แล้ว +2

      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. 🙂

    • @OfirHadad
      @OfirHadad 2 ปีที่แล้ว

      ​@@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)

  • @Hidesinmud
    @Hidesinmud 6 หลายเดือนก่อน

    When I try to add the HealthBar script to the HB_Fill it says “the script class cannot be found.”

  • @sckosta
    @sckosta ปีที่แล้ว

    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!!!

  • @ggame1022
    @ggame1022 2 ปีที่แล้ว

    How can you change the color of a specific word

  • @Pwegoable
    @Pwegoable ปีที่แล้ว

    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

  • @willswingler
    @willswingler ปีที่แล้ว

    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.

    • @juventinopacheco2888
      @juventinopacheco2888 11 หลายเดือนก่อน

      I get this same thing, and was wondering if you found out what it was

    • @Naveed22666
      @Naveed22666 9 หลายเดือนก่อน

      Same

  • @Naveed22666
    @Naveed22666 9 หลายเดือนก่อน

    I am getting a null reference error. Why is that I wonder?

    • @Dani_Krossing
      @Dani_Krossing  9 หลายเดือนก่อน +1

      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. 🙂

    • @Naveed22666
      @Naveed22666 9 หลายเดือนก่อน

      @@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

  • @slogannots3366
    @slogannots3366 2 ปีที่แล้ว +1

    But how do you make a health bar in real life?

  • @victorverbeke
    @victorverbeke ปีที่แล้ว

    pls

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว

      I'm gonna need more text to understand that comment. 😂

  • @cheesewizard3659
    @cheesewizard3659 ปีที่แล้ว

    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.