Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 jchase520 · Feb 16, 2011 at 04:11 AM · health

Health Functions in Unity?

I've been looking through the Unity Scripting reference and haven't been able to find any commands dealing with a players health, are these included in Unity or do I need to make my own system?

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

3 Replies

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

Answer by doomprodigy · Feb 16, 2011 at 04:56 AM

As DaveA said, You have to program it yourself, Health is straightforward, Try to be a lot more specific with your questions.

Here is some health (C#)

public float Health = 100f;

There is health, merely a float. Now depending on what your doing you can add health, subtract health, render some gui text of health variable on the screen, or render images of a health bar on your screen depending on what amount of hp you have.

Now if you are curious as to how you subtract or add health or render it on the screen ask a question with some code your have written that is not working or just ask how you do it.

Cheers, Aaron Lewis

Comment
Add comment · Show 2 · 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 jchase520 · Feb 16, 2011 at 05:34 AM 0
Share

well no I was just curious I thought for sure Unity would have something like that. Now that I know theres no function I can make a system real quik . :)

thank you both

avatar image jchase520 · Feb 16, 2011 at 05:36 AM 0
Share

I gave you both up but gave the answer to Aaron cuase he only has 228 points lol

avatar image
1

Answer by DaveA · Feb 16, 2011 at 04:25 AM

Your own system. It's all up to you if someone/something lives or dies and how. Have fun!

Comment
Add comment · 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
0

Answer by Design3.com · Feb 17, 2011 at 12:42 AM

Yeah, just create your own variable and use it as you see fit to make calculations, display onscreen, etc.

var health : float = 100;

or

public float Health = 100f;

Design3 has a walkthrough here: http://www.design3.com/unity/fundamentals/unity-gameplay-a-scripting-primer/item/25-u1012-chapter-04-player-state-machine#comment38

Comment
Add comment · Show 1 · 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 Tracey P · Feb 20, 2011 at 07:25 PM 0
Share

you have to be a mem to watch it

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

No one has followed this question yet.

Related Questions

Enemy Health Problem 2 Answers

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

A node in a childnode? 1 Answer

When my button is pressed the action reapeats 1 Answer

Spawning Error.. 0 Answers


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