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 Jumper28 · Jun 17, 2012 at 05:44 PM · barprogressprogressbarhealth

Problem ProgressBar with health + Time the poison

Hi, I have a problem with Progress Bar with health + Time the poison, Player get marker (gameobject) no poison and up health... and my code is error

 var health : int = 100;
 var healthTexture1 : Texture2D;
 var healthTexture2 : Texture2D;
 
 function OnGUI () {    
     GUI.DrawTexture(Rect(55,Screen.height - 55,100,5), healthTexture2);
 
     var boor : int = health * hePoison; 
     GUI.BeginGroup(Rect(55,Screen.height - 55,boor,15));
     GUI.DrawTexture(Rect(0,0,100,5), healthTexture1);
 }
 
 function Update(){
     hePoison = Time.time * -0.01;
     heMarker = Time.time * 0.15;
 }


Hi, Sorry i long not type to comment, This Is bad my script, I idea... Player has 60 second to die, Player must move to marker (gameobject) here and give you up time, do you know? How not understand it type comment.


I have problem script, Script's can't up the bar, and time it 0.05 bar is 1 it's can't. My code:

 var progress : float = 1;
 var progressmin : float = 1;
 var pos : Vector2 = new Vector2(20,40);
 var size : Vector2 = new Vector2(60,20);
 var progressBarEmpty : Texture2D;
 var progressBarFull : Texture2D;
 var Point : Transform;
 var Player : Transform;
 
 function OnGUI()
 {
     GUI.DrawTexture(Rect(125,Screen.height - 75,135,20), progressBarEmpty);
     GUI.DrawTexture(Rect(125,Screen.height - 75,135 * progress * progressmin,20), progressBarFull);
 } 
 
 function Update()
 {
     progress = (Mathf.Clamp( Time.time, 0, 1))* -0.05;
 }
 
 function Download()
 {
     Point.parent = Player.transform;
     progressmin = (Mathf.Clamp( Time.time, 0, 1))* 1;
 }
Comment
Add comment · Show 1
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 Jumper28 · Jun 26, 2012 at 04:21 PM 0
Share

i need correct it my scrpt! please!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Berenger · Jun 17, 2012 at 06:34 PM

hePoison and heMarker are not declared. Plus, you need to call GUI.EndGroup at the end of your OnGUI, as you called GUI.BeginGroup before.

Could you rephrase your question ? Or post it in your own language, I'm sure someone can help with the translation.

Comment
Add comment · Show 12 · 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 Jumper28 · Jun 17, 2012 at 08:01 PM 0
Share

Do it just only need one GUI.EndGroup?

function OnGUI () {

GUI.DrawTexture(Rect(55,Screen.height - 55,100,5), healthTexture2); var boor : int = health * hePoison; GUI.BeginGroup(Rect(55,Screen.height - 55,boor,15)); GUI.DrawTexture(Rect(0,0,100,5), healthTexture1); GUI.EndGroup (); } And I need be ready to does work. $$anonymous$$ust be does work! Please.
avatar image Berenger · Jun 22, 2012 at 04:41 PM 0
Share

Close enough.

 function OnGUI () {
     var lifePercentage : float = health / maxHealth;
     GUI.BeginGroup(Rect(55,Screen.height - 55, lifePercentage  * 100,15));
     GUI.DrawTexture(Rect(0,0,100,5), healthTexture1); 
     GUI.EndGroup ();
 }
avatar image Jumper28 · Jun 26, 2012 at 07:31 PM 0
Share

Script hasn't poison... go down health, get point (gameobject) got up health with time. I need help!

avatar image Berenger · Jun 26, 2012 at 09:49 PM 0
Share

Do your want to increase your health over time ?

avatar image Jumper28 · Jun 27, 2012 at 07:49 AM 0
Share

Not increase, smaller with time in health, and Player move to point position get higher with time in health, Please help me!

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to add texture in onGUI() 0 Answers

Health Help D: 2 Answers

Far Cry 3 Health Bar System 2 Answers

Progress Bar 2 Answers

Enemy Health Bar 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