Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Nackles42 · Sep 14, 2018 at 03:06 AM · healthbarhealth barhealth

Trying to make a unique type of health 'bar'

Hi, for the game I'm working on, I'd like the health bar to be a bit more unique than the standard UI Sliders. My game has a bunch of different characters with different amounts of health, and what I'm wondering is what the best way to try and make a slider that either:

1) Increases in length the higher the max HP of the character, or 2) Tracks health in 'dots' that disappear as they take damage (Like from the Ur-Quan Masters, link is here: https://www.youtube.com/watch?v=59NFcw54STI )

Any tips would be much appreciated.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Stratosome · Sep 14, 2018 at 04:55 AM

Hiya!

Well, it seems fairly straight forward to me but perhaps I'm misunderstanding something. I'll look at your first... uh, question (?). So, if you want a slider that increases in length as the character's max health increases, couldn't you just make the length of that bar equal to that max health value or something related? If you've got a little GUI element to represent this slider, just set the width of it depending on the max health. For your second question, if you wanted to potentially have dots represent the max health, couldn't the number of dots just be the max health value? Perhaps you'd draw 10 black dots (max health of 10), and then 9 red dots over the black ones (current health is 9). As the current health drops or increases, just draw or remove the dots. Not quite sure how else to answer your question here... If you have perhaps a bit more specific of a question though, I'd be happy to try to answer it.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Der-Die-Das · Sep 14, 2018 at 05:30 AM 1
Share

For the second question. you could also use a particle system to achieve something like in the video and play with the life span (amount of the dots) and a gradient over life time.. It might look good but wouldn't be as accurate as manually drawing those dots.

avatar image Nackles42 · Sep 14, 2018 at 01:41 PM 0
Share

I'm sorry, thank you for your help, though I probably worded it badly. When I try to increase the length of the healthbar (which I want in the corner) the bar increases in length on both sides and goes off-screen. Is there a way to fix that? And for the dots thing, is that a Gizmos thing? Sorry, it might be kind of obvious that I'm kinda a noob

avatar image Stratosome Nackles42 · Sep 14, 2018 at 05:32 PM 1
Share

Gizmos are more for just debugging things. You'd probably want to use sprites for your health "bar". As for your UI Slider growing on both sides ins$$anonymous$$d of just one, there are a couple ways you could fix this. 1. You could adjust the x position while changing the width of the slider. This way one side of it would appear to be still. 2. Alternatively, the EASIER WAY, would be to find the Slider component on your UI object, and change the pivot to something else. By default, it is X = 0.5, Y = 0.5. If you make the X value 0.0, the left side of your slider won't move while growing/shrinking.

avatar image Nackles42 Stratosome · Sep 15, 2018 at 05:25 PM 0
Share

Thank you very much, the pivot worked perfectly. As for using sprites for the dot-based bar, considering max health values can reach about 40 but I still want 1 dot to equal 1 HP, it would be possible, just be very tedious to do it. This has been very, very useful. Thank you.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

89 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Player health dropping far to fast 1 Answer

My health bars HealthBar.fillAmount doesnt change.tnx,i nead a help in fillamount :pls my HealthBar doesnt change. i dont know what to do.pls:) 2 Answers

I need help with the player's health points 1 Answer

Health Bar decreases in both directions 0 Answers

How to make my health decrease? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges