Search Unity

Energy Bar Toolkit - 2D and 3D Progress Bars

Discussion in 'Assets and Asset Store' started by genail, Mar 30, 2013.

  1. lenzchu

    lenzchu

    Joined:
    Dec 7, 2013
    Posts:
    15
    Thanks! sounds like a good alternative ^^ I'll do just that for now. Would be an amazing feature in the future none the less!
     
  2. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Hi,

    How would I detect if a bar is "burning" or not? I would like to only be able to do something whilst the bar is not "burning out".

    Thanks, Adam
     
  3. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello There!

    There's no any standardized way to do that, but you can hack EBT a little :)
    Go to EnergyBarBase.cs and on line 63 I think you should find:

    Code (CSharp):
    1.     protected float ValueFBurn;
    2.     protected float ValueF2;
    Change protected to public and then you can do the following:

    Code (CSharp):
    1. var renderer = barObject.GetComponent<EnergyBarBase>();
    2. bool burning = renderer.effectBurn && renderer.ValueF2 != renderer.ValueFBurn;
    Please let me know if this is working!

    Cheers!
    Piotr
     
  4. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Its working great thanks! Any chance this could be added in as a feature? Maybe an "IsBurning" method? Thanks again.
     
  5. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Sure, why not! :) I will add something like this in the next release!
     
  6. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Thank you! Is there any chance I could get access to the early uGUI integration? I would much rather use uGUI for everything in this project, and as the NGUI integration has a couple of issues which I cannot get around, it would be much easier.
     
  7. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Sure! Please write to me to support@madpixelmachine.com with your invoice no. and I will send you the latest version as soon as it is ready!

    Cheers!
    Piotr
     
  8. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Thanks! Ive sent the email :)
     
  9. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    The uGUI integration is superb! Thank you for such great support, this has made my project much more streamlined now and I can focus on using just uGUI rather than multiple systems :)
     
  10. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    I'm happy to hear that! I'm working on this one really hard lately :) There are still two renderers to support and I'm good to go.

    If there's anyone else want to participate in beta program, please write to me to support@madpixelmachine.com with your invoice no. !

    Cheers!
    Piotr
     
  11. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Nice work Piotr.
    Cheers
     
  12. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Thank you! :)
     
  13. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Luckily I only needed the Filled Renderer, so im good to go now! The integration took me a few minutes at most, and its now 100% working with uGUI UI :) No more awkward NGUI integration.

    I think I have found a bug, ill email you with the details once ive checked its genuine.
     
  14. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Piotr,
    I'm using energy bar for my player's health :
    Code (CSharp):
    1. void Update() {
    2. if (curHealth <= 0F) {
    3.                PlayerDead();
    4.                Debug.Log("Player died!");  
    5.             }
    6.             if (player.position.y <= -15){
    7.                PlayerDead();
    8.             }
    9. }
    10.  
    11.     public void PlayerDead(){
    12.         gameOver.SetActive(true);
    13.         playerGUI.SetActive(false);
    14.         Time.timeScale = 0f;
    15.         AudioListener.pause = false;
    16.         PlayerPrefs.SetInt("TotalDeaths", PlayerPrefs.GetInt("TotalDeaths", 0) + 1);
    17.         Debug.Log("Death added, TotalDeaths : " + PlayerPrefs.GetInt("TotalDeaths"));
    18.     }
    *and I want to store how many times my player died...what I get when my player dies once I get some hundreds deaths, I presume this issue is from Update ?! How can I fix this ? Thanks !
     
  15. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    That's a simple one :)
    Please create a new field:

    public bool alive = true;

    then instead of simply calling:
    PlayerDead()

    Do something like this:

    Code (CSharp):
    1. if (alive) {
    2.     PlayerDead();
    3.     alive = false;
    4. }
    Of course set alive to true whenever player gets its life back :)

    Cheers!
    Piotr
     
  16. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Just realised you already know about the bug in the uGUI beta, its the burn colour not working :)
     
  17. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello,
    Yep, it will be fixed in the beta-2 next week :) Please let me know about any other issues that you will find!

    Cheers!
    Piotr
     
  18. Deleted User

    Deleted User

    Guest

    Is it possible to change the repeat count programmatically for a repeater bar?
     
  19. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Sure! You just have to access the renderer:
    Code (CSharp):
    1. var rend = barObject.GetComponent<RepeatedRenderer3D>();
    2. rend.repeatCount = 10; // your new repeat count here
    Please let me know if this is working for you :)

    Cheers!
    Piotr
     
  20. Deleted User

    Deleted User

    Guest

    Works great! Thanks! Excellent tool and amazing response time!
     
  21. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    You're welcome! :)
     
  22. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello Mad Level Manager and Energy Bar Toolkit users! Today I’d like to share with you my plans about the future of these two tools. I'm posting about these two tools at once, because these two tools have a common codebase and I didn't want to break this into two.

    I believe it’s a matter of weeks when the final release of Unity 4.6 will see the daylight. At the moment of writing this there’s a first release candidate version available for anyone who wants to. Unity 4.6 will introduce a new GUI system called uGUI and to be honest I am a little disappointed, because this is how GUI system in Unity should look like in the first place, and by the time being many developers have created their own GUI systems which are completely incompatible with each other. I am one of these developers.

    Energy Bar Toolkit and Mad Level Manager are using Mad2D drawing library (this is my own creation) which is quite good, but’s it’s based on some assumptions that will be broken with Unity 5.0 (I will talk about this in a moment). Anyway, uGUI is great, uGUI is flexible, uGUI is extensible, and I am still under big impression how well-written it is. Now I’ve decided to migrate Mad Level Manager and Energy Bar Toolkit to uGUI. Just by the accident uGUI version of Energy Bar Toolkit and Mad Level Manager will be marked the same as the 3.0.0 version.

    Currently I am on the last stage of moving Energy Bar Toolkit bars to uGUI (not including testing). Let’s say it’s finished in about 75% and I have only one more renderer to migrate. I can tell right now that the easiness and performance of Energy Bar Toolkit uGUI implementation has never been better! I cannot wait to release it, but as a well-known Unity Asset Store publisher I have to maintain a high quality of my products, so it may take me about 1 month from now to get things done. After the release of 3.0.0 I will focus on adding new renderers and extending the current ones by more advanced configurations and effects.

    The state of Mad Level Manager is slightly different. For about 3 months I am working on level grouping feature. Along with groups I will introduce a new feature called advanced unlocking conditions. These conditions will allow MLM users to strictly define how and when groups and level icons can be unlocked without any additional programming. Here are some examples:

    • Group will unlock if total number of collected stars >= 60
    • Level will unlock if 10 levels in this the current group has been completed
    • Group will unlock if all levels of previous group has been completed
    • Level will unlock if total number of collected stars in current group >= 30
    • Level will be unlocked if total game score is above 20000
    • Level will be unlocked if previous level score is above 1000
    What’s more, icons are able to display these conditions (label like 25/30 stars), just like in games you already know!

    If you have some programming experience, you can do even more! You can write a delegate function for the unlocked, and its result will define when exactly level should be unlocked. This will be a way to create levels and groups that can be unlocked only if the player will download the DLC. These changes will be introduced in Mad Level Manager 2.5.0.

    There’s one more thing that will complicate all this a little and I’m talking about the release of Unity 5.0.Unity developers have decided to break compatibility on some aspects, and one of them is how meshes with different materials are rendered. In Unity 4 submeshes were rendered at the index order, but in Unity 5 rendering is done in a way that reduces the number of context switches. This is really good news for mobile devices and not very good news for Mad2D rendering system, because it is basing on the rendering order. There’s a workaround this, but will require from users to switch toatlases instead of using separate textures. Also fonts are not supporting atlases currently, so this workaround will require me to do some patches to Mad Level Manager code.

    I want to post these kind of thoughts more often from now on. Please let me know about your thoughts and have fun using Energy Bar Toolkit and Mad Level Manager!

    tl;dr Mad Level Manager and Energy Bar Toolkit will switch to uGUI. Unity 5.0 will break Mad Level Manager rendering system, I am working on a workaround.

    Cheers!
    Piotr
     
    Last edited: Nov 17, 2014
    GCatz, hopeful, OnePxl and 1 other person like this.
  23. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Thanks for the update. The uGUI integration for EBT is amazing, its so simple to setup and just works out of the box. Couldn't be happier!

    Id love to see more effects in the system, but thats the only thing I can think of right now! Great job, keep up the good work.
     
  24. IOZO

    IOZO

    Joined:
    Jun 26, 2010
    Posts:
    55
    I'm using the new Beta EBT with the filled renderer UGUI and I have some issues with the sprites integration.
    I don't know if it's me or if I need an update but everything's fine as far as I'm not trying to use background and foreground sprites.

    It works pretty well if I only use the sprite renderer for the bar itself but if I add a background sprite for instance I can't easily adjust the scale and position of the bar and the background sprite for instance. I can scale both sprites together but not the generated bar and generated_background.

    At the moment I put all background textures on a sprite renderer outside of the Canvas and set EBT with the bar only. It works but I'd like to use the foreground/background texture for a better control.

    Thanks
     
  25. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello IOZO,

    You cannot individually control the position and properties of foreground and background sprites. The reason that these are visible are because of beta version and soon these will be hidden under the debug mode.

    If you need to adjust your background and foreground positions, you should do it using graphics editing software. This is why: http://energybartoolkit.madpixelmachine.com/doc/2.1.6/other/graphics_guidelines.html

    Cheers!
    Piotr
     
  26. IOZO

    IOZO

    Joined:
    Jun 26, 2010
    Posts:
    55
    ok, and it works very well. thanks.
     
  27. ChaneDev

    ChaneDev

    Joined:
    Feb 12, 2013
    Posts:
    66
    Hello, I am using Play Maker, NGUI, & Energy Bar Toolkit. I am trying to figure out how to trigger an action after the Smooth Effect is complete.

    upload_2014-11-24_21-6-39.png

    Basically I want the bar to slide in, the Smooth Effect to fill to the set position, and for the bar to slide out. Here is the example:


    Any suggestions? I've tried a bunch of things, but no luck so far.

    Thanks,
    ~C - - -
     
  28. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello ChaneDev,
    I've made a little modification :) I will send you a version in a moment that looks like this:



    Please let me know of any issues!

    Cheers!
    Piotr
     
  29. ChaneDev

    ChaneDev

    Joined:
    Feb 12, 2013
    Posts:
    66
    You sir, are awesome! I'll verify this soon and let you know!
     
    genail likes this.
  30. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hey everyone!

    Energy Bar Toolkit is on sale, 50% off!

    On that occasion I've prepared for you a free bars pack! You can grab it here!

     
    RoyalCoder likes this.
  31. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hey Energy Bar Toolkit users!

    Today I want to announce that Energy Bar Toolkit 3.0.0 is right around the corner! Yesterday I've released the fifth beta, now I will prepare two, maybe three Release Candidate versions, and then it will be available officially in the Unity Asset Store!

    Let me remind that the main feature of Energy Bar Toolkit 3.0.0 is full, native uGUI support!

    If you own Energy Bar Toolkit and you want to participate in Beta program, please write to me to support@madpixelmachine.com with your invoice no.



    Cheers!
    Piotr
     
    RoyalCoder, Alanj2007 and hopeful like this.
  32. Alanj2007

    Alanj2007

    Joined:
    Aug 22, 2013
    Posts:
    17
    I can't wait for v3! I've watched uGUI tutorial of this plugin and looks really awesome! This makes my life more easier :3
     
  33. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello Alanj2007,

    If you're interested in participating in the beta program, please write to me to support@madpixelmachine.com with your invoice no. :)

    Cheers!
    Piotr
     
  34. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    What's the status on EBT 3.0?

    (I'm hoping that if I ask, it will suddenly appear. lol)
     
  35. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello hopeful,
    Until now I've released 7 beta versions and one RC version. Most probably there will be RC-2 and maybe RC-3, and after that I will send it to the asset store :)

    If you're interested in receiving it earlier, please send your invoice no. to support@madpixelmachine.com :)

    Cheers!
    Piotr
     
  36. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Piotr, great news with new EnergyBarToolkit ....I have a little question I'm using energy bar for my player's health and attached simple event script on my traps,powerups etc. for decreasing or increasing the health value , the problem is I made some enemies who shoots in the player with projectile prefab (with simple event script on it) ...but I can't access my healthbar from prefab => can't make any damage to the player...any suggestion how to make it work ?! Thanks in advance ;)
     
  37. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello Dorin,
    Maybe try to do it the other way by attach the Simple Event script to your player? In that way you will keep your reference to the bar object :)

    Please let me know about the results!
    Cheers!
    Piotr
     
    RoyalCoder likes this.
  38. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Thanks a lot Piotr, problem solved ;) ...first time I made'it the way you suggest by I thought this is wrong ;) ...anyway thanks for your great and quick support ! ;)
     
  39. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    You welcome! :)
     
    RoyalCoder likes this.
  40. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hey @ChankyGames, I see what you did there.
    Posting and removing your asset link here is a really shady practice you know. You will be reported.

    For those who do not know:
    @ChankyGames just posted here a link to his loading screens solution and he've removed it right away. In the results all thread subscribers have received his advertisement. I'm not against competition, but that's not a fair one.

    Cheers,
    Piotr
     
    mimminito likes this.
  41. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Has he used any of your code as well? Ive not purchased it, but I can see that he has a system for the new UI and OnGUI.
     
  42. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    I doubt that :)
    To be honest it's not difficult to create a simple progress bar with uGUI right now. That's why when 3.0.0 will be released I will focus on features that are difficult or impossible to achieve with uGUI only, for instance:


    There are so many things that I want to do. Sometimes I feel like I should make a clone of myself :)

    Cheers!
    Piotr
     
    mimminito likes this.
  43. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello everyone, I have some important news!

    Unity Asset Store team gave us the ability to send vouchers for our products. Number of these vouchers is limited, I don't want them to go to waste either so I've came up with this little idea...

    If you're a Unity3D developer, your game is still in progress and you're interested in acquiring one of my products, then check this out! Each month I will give away free vouchers if at least one person will ask for it :) If you're not interested and you have a friend who is creating his own game, let him know! Of course there are some rules.

    This is the first time I'm doing something similar, so if you have any suggestions or questions, please write freely!

    Cheers!
    Piotr
     
  44. Den D.

    Den D.

    Joined:
    May 30, 2014
    Posts:
    11
    Hi Piotr, I have a doubt with EnergyBarToolkit. I have created a game where player is in continuous search for health
    the health decrease on a constant rate. the problem is then i pause the game the health still decrease rather than pausing at the instance.
    Is there any way that i can stop the health from decrease when pause I tried search for TimeScale but could not found it anywhere
     
  45. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello Den,
    Thank you for writing!

    How are you pausing your game? If you're setting Time.timeScale to 0 and you're not using the smooth effect, the bar will change it's appearance when you will change its value. How do you decrease its value? If you're doing it using the external script, then you should do a Time.timeScale check inside of it. If not, please let me know, this may be a bug :)

    Cheers!
    Piotr
     
  46. Den D.

    Den D.

    Joined:
    May 30, 2014
    Posts:
    11
    I am using EnergyBarToolkitNGUI 3.0.8
    This is the sample snippet of my code where the value of the bar is decreased or increased with respect to a Speedbar
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class ShipHeatSensor : MonoBehaviour {
    5.  
    6.     GameObject heatMeter;
    7.     private EnergyBar hMeter;
    8.     int HvalueCurrent;
    9.  
    10.     GameObject speedOMeter;
    11.     private EnergyBar speedbar;
    12.  
    13.  
    14.     void Start () {
    15.         heatMeter = GameObject.FindWithTag ("HealthMeter");
    16.         hMeter = heatMeter.GetComponent<EnergyBar>();
    17.         speedOMeter = GameObject.FindWithTag ("SpeedOMeter");
    18.         speedbar = speedOMeter.GetComponent<EnergyBar>();
    19.     }
    20.    
    21.  
    22.     void Update () {
    23.         if (speedbar.valueCurrent > 25 && speedbar.valueCurrent < 37) {
    24.             HvalueCurrent = HvalueCurrent - 1;
    25.             if((HvalueCurrent%100)==0){
    26.                 hMeter.valueCurrent = hMeter.valueCurrent - 1;
    27.             }
    28.         } else if (speedbar.valueCurrent > 38) {
    29.             HvalueCurrent = HvalueCurrent - 2;
    30.             if((HvalueCurrent%100)==0){
    31.                 hMeter.valueCurrent = hMeter.valueCurrent - 2;
    32.             }
    33.         } else {
    34.             if(hMeter.valueCurrent<hMeter.valueMax){
    35.                 HvalueCurrent = HvalueCurrent + 1;
    36.                 if((HvalueCurrent%100)==0){
    37.                     hMeter.valueCurrent=hMeter.valueCurrent+1;
    38.                 }
    39.             }
    40.         }  
    41.     }
    42. }
    43.  
    and i am setting Time.timeScale to 0 to pause my game

    these are the setting of my Progress bar
     
  47. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    614
    Can i use this with the new unity UGUI.

    meaning can i make a progress bar be a 2D object in a Unity Canvas? like an image or something so it can be part of my game user interface.
     
  48. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Please try adding this on top of your Update() function:

    Code (CSharp):
    1. if (Time.timeScale == 0) {
    2.     return;
    3. }
     
  49. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello luniac,
    Yes! Energy Bar Toolkit 3.0.0 is featuring a native integration with uGUI! It's not released yet, but it will be in the next week or two. If you want it right now, please send me your invoice no. to support@madpixelmachine.com

    Cheers!
    Piotr
     
  50. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    614
    its cool ill just purchase it when it comes out, no rush.