Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Energy Bar Toolkit - 2D and 3D Progress Bars

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

  1. ergoSum

    ergoSum

    Joined:
    Mar 1, 2014
    Posts:
    2
    Thanks for your prompt reply Piotr.
    I did get it to work, once I realised that I had to use the mesh bar option rather than try and tie it to DF-GUI. Then you have to set the scale parameters to get the required size.
    I discovered that there is a dfFollowObject3D script in DF-Gui, though it is very new and still an area being grappled with by the users and perhaps the author. I couldn't get this to function, possibly because EBT continues to adjust the location in strange ways, whether anchored to screen or object, or not anchored at all. Is there a way to disable EBT's proclivity to adjust the position of the toolbar?
     
  2. genail

    genail

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

    In the matter of fact the DF-GUI integration is mostly adjusting mesh bar transform, so it can be controlled and anchored just like DF-GUI widget, so if you create "DF-GUI bar" in fact you're creating a script that will constantly adjust the mesh bar position. I've just updated DF-GUI and yes, the follow script is there :) Although I am not sure what is your issue (it works quite well for me). Can I ask you for a screenshot or example scene as a PM?

    Cheers!
    Piotr
     
  3. kokkorollo

    kokkorollo

    Joined:
    Jan 16, 2013
    Posts:
    9
    hi, I have purchased this asset few hours ago, bu i can't understand if there is a way to know if user has clicked on bar?
    I want to know in wich pixel position (related to mobile screen) is the texture drawed.
    i need of a button with a circular bar aroud it.
    can i made it all with this tool?
     
  4. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello kokkoroll,
    Thank you for purchasing Energy Bar Toolkit!

    It may be difficult to determine texture coordinates of a mouse click. I recommend using mesh bars, and adding colliders to the ones that you want to watch. What is your use case?

    About that button: you can easily integrate EBT with DF-GUI or NGUI, so this should be easy thing to do ;-) There are some limitations though.

    Cheers!
    Piotr
     
  5. Psygantic

    Psygantic

    Joined:
    Mar 4, 2014
    Posts:
    10
    Is it possible to use sliced sprites for EBT bars like DF-GUI can for its progress bars, so they can be scaled arbitrarily?
     
  6. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello Anomalous,
    Do you have any example of this feature?

    Cheers!
    Piotr
     
  7. Psygantic

    Psygantic

    Joined:
    Mar 4, 2014
    Posts:
    10
    Sure. Skip to 4:40 in this DF-GUI tutorial.

    That example is for buttons, but it works the same way for progress bars. Sliced sprites can have decorated edges and rounded corners that can be scaled in any direction without distorting.
     
  8. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Thanks!

    This is a planed feature at the moment with a high priority set, but first I need to release Energy Bar Toolkit 2.0 with atlases support, because this feature has even higher priority.

    What is your deadline? I can sign you up to my private dev channel list and send you something as soon as I have it. I am sending untested versions a lot, because I've got many, many feature requests :)

    Cheers!
    Piotr
     
  9. Psygantic

    Psygantic

    Joined:
    Mar 4, 2014
    Posts:
    10
    I'll just wait for atlas support in 2.0, as that's actually more important to me as well.
     
  10. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    If you want I've got a RC version :)
     
  11. Gigiwoo

    Gigiwoo

    Joined:
    Mar 16, 2011
    Posts:
    2,981
    Do you have a version I can download for 3.5.7? After purchasing it, I was bummed to discover I couldn't integrate it into my project as it requires 4.x. Hope you can help.

    Gigi
     
  12. genail

    genail

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

    Thank you for writing!

    I'm sorry but Energy Bar Toolkit is only for Unity 4.1.2 or higher. There was a time when I've tried to support earlier Unity versions, but there were so many differences and problems arising from how Unity treated textures in 3.5 and 4.x that I've decided that it's not worth it.

    But I did a quick dirty thing. I've prepared EBT version for Unity 3.5.7, but it has:
    - no prefabs
    - no example scenes
    - no materials
    - no ongui renderers
    - no gradients

    That's because there's no simple way to downgrade these things.
    I recommend to upgrade your projects to Unity 4.x as soon as you can ;-)

    Please check your PM inbox.

    Cheers!
    Piotr
     
  13. Gigiwoo

    Gigiwoo

    Joined:
    Mar 16, 2011
    Posts:
    2,981
    Will it still be functional? If it is, then I could probably experiment with it on a 4.x box. Once the integration is working, I would then know how I wanted to use it in the 3.5.7 version. Assuming the core functionality still works - lack of materials and gradients sounds crippling.

    Upgrading to 4.x Pro is a $2250 decision (pro+ios+android). And the features are not that compelling for Gigi, yet.

    And of course, thank you very much for taking a stab at it Piotr! I look forward to trying it out.

    Gigi
     
  14. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    The mesh renderers should be fine, but it is untested, so I really cannot tell... Ahh, integration packages should be repacked too.

    Cheers!
    Piotr
     
  15. fieldrequired

    fieldrequired

    Joined:
    Feb 26, 2014
    Posts:
    108
    Hi,

    So in my game I'm instantiating enemy's and in some cases player objects RTS style. I've created a bar in the style I like and packaged it as "GUIBar", I instantiate the bar in my script using:

    Code (csharp):
    1. sheildBar = Instantiate(Resources.Load("GUIBar")) as GameObject;
    That works fine, I then try to move the bar using the publicly accessible 'screenPosition'

    Code (csharp):
    1. sheildBar.GetComponent<EnergyBarRenderer>().screenPosition = new Vector2(100, 100);
    and I get the error:

    Code (csharp):
    1. Assets/GUIOverlay.cs(34,40): error CS0246: The type or namespace name `EnergyBarRenderer' could not be found. Are you missing a using directive or an assembly reference?
    Do you know why? The EnergyBarRenderer definitely is part of the GameObject (see below) I know its something simple but its driving me mad!

    $renderer.png
     
  16. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello fieldrequired,
    Thank you for purchasing Energy Bar Toolkit!

    I believe that you simply have to include:

    using EnergyBarToolkit;

    At the top of your cs file ;-)

    Cheers!
    Piotr
     
  17. fieldrequired

    fieldrequired

    Joined:
    Feb 26, 2014
    Posts:
    108
    Oh my god how annoying, thats been bugging me for hours - I nearly started to write my own bar haha!

    Just converted from JS to C# following interoperability nightmares so erm, yeah excuse meeee.....
     
  18. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hey, no problem!

    I will put this one into the FAQ ;-)
     
  19. fieldrequired

    fieldrequired

    Joined:
    Feb 26, 2014
    Posts:
    108
    Yeah might be handy, although I must say your documentation is pretty good - especially the video.

    So i'm successfully instantiating the object (as in the thing isn't giving me errors anymore) how come I can't see it? If I drag it from the assets into the hierarchy it pops up just fine...

    Appreciate the help :)
     
  20. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    There may be several reasons for that:

    1. Please make sure that "Relative to Transform" is disabled
    2. screenPositionNormalized must be set to false
    3. There are no textures
    4. Renderer script is disabled

    The best way to tell is to pause your scene right after instantiating and then check the created object in the hierarchy.

    Cheers!
    Piotr
     
  21. lenzchu

    lenzchu

    Joined:
    Dec 7, 2013
    Posts:
    15
    Bought it during sell and loved it since! Dunno if anybody mentioned it but I was trying out the mesh render of the fill progress bar and the Radial CW and CCW Grow Direction is broken. The regular on GUI is fine though.

    Also is it normal that when I press play, the Energy Bar toolkit broke it's prefab when i unplay. I know it's because of the atlas it has to create and decreate gameobjects on play. But I like to keep things connected. I'm ganna use the old GUI pipeline for now ^^
     
    Last edited: Mar 9, 2014
  22. BHMW

    BHMW

    Joined:
    Feb 8, 2014
    Posts:
    16
    This toolkit is great, having fun with it, but I have a question.

    How do I make my energy bar that is anchored to the player appear underneath the player instead of on top of it? Just like as shown in the main video here http://www.youtube.com/watch?v=BD5uJi8gH64#t=0

    Thanks
     
  23. Dantas

    Dantas

    Joined:
    Mar 9, 2014
    Posts:
    28
    Also interested in this.
     
  24. MPM_Qler

    MPM_Qler

    Joined:
    Aug 14, 2013
    Posts:
    3

    Hey all! I'm new here, but I am related to MPM and have permission to write that issues that You're having will be fixed soon in EBT 2.0.0.

    Cheers!
     
  25. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Thank you Qler for takin this for me. Indeed, EBT fixes this issue and it is currently in testing stage.

    About the movie. This was done using multiple cameras, masks and depths. It is easy if you know how cameras are working, but in EBT 2 you will be able to put your bars in 3d space without need of setting up multiple cameras. Of course a tutorial how to do this will be made :)

    P.S. The credits for this movie goes to Qler. Thank you! :)

    Cheers,
    Piotr
     
  26. ojuzu

    ojuzu

    Joined:
    Jun 29, 2006
    Posts:
    67
    That's going to be great, Piotr! Getting the health bars to stay in a consistent position as the camera angle changes has been tough sometimes. Any idea when EBT 2 will be released?
     
  27. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Hi!

    Just start using your awesome package. I'm trying to make some bar like the one you have in the energy bots player . I'm trying to use the filled 3d renderer, but i can't see the bar at all. I've copied the circle bar of the demo scene and use it in my scene and can't see anything. Only the green outline of the object. I've used the init tool, but nothing. i only have one camera in perspective mode, so when it adds the 2d camera is set to ortho and depth only. The bar is child of the Anchor GameObject and this is child of the panel, and the anchor is the player.

    other bars works perfectly, but i like the 3d rotated circle. It seems to be something wrong with the camera. Any idea? I'm sure that it is something really easy to see, but i can't!


    Thanks!
     
  28. genail

    genail

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

    Have you set the anchor camera for the Anchor object?
    Can you post some screenshots if your setup? I'd like to see this green outline, your hierarchy and the inspector of Anchor object.

    Cheers!
    Piotr
     
  29. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Hi again Piotr,

    i've just repeated the process from the start to take screenshots and now it works like a charm!

    Obviously it was my fault at some point.

    Sorry, and thanks anyway! Your work is awesome and realy time saving!


    Cheers!
     
  30. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    That's good! And I am happy that you find my tool useful! Have fun with it ;-)

    Cheers,
    Piotr
     
  31. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Just one thing,

    What if i want more than one circle bar in the same character? lets say one circle bar inside another bigger. I have to add a second renderer to the same object or each one has to be independent?


    Thanks!
     
  32. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Exactly! If you will match the texture sizes then it should fit to each other.
     
  33. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Nice!!!!

    Thanks a lot!
     
  34. fieldrequired

    fieldrequired

    Joined:
    Feb 26, 2014
    Posts:
    108
    Hi there, how would I go about hiding the bars if they were a certain distance from the camera? And are they hard-coded to a particular layer? I've assigned them to a hidden layer as I don't want them visible by default but they just seem to show anyways!

    Thanks!
     
  35. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    If you're using mesh bars, then you should set the layer for the Panel object, because it is the renderer.
    If you're using OnGUI bars then I am afraid there's no easy way to hide the bars. You have to write custom script to control the visibility.

    P.S. This is a nice idea for the new feature! Thanks!

    Cheers,
    Piotr
     
  36. lenzchu

    lenzchu

    Joined:
    Dec 7, 2013
    Posts:
    15
    Cool awsome to hear that ^^
     
  37. fieldrequired

    fieldrequired

    Joined:
    Feb 26, 2014
    Posts:
    108
    Ah so basically its a 'code it yourself' sort of scenario, not a problem *rolls sleeves up*

    Before I start, is it something you'll write and release sooner or later?
     
  38. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Not exactly.
    You see, OnGUI type renderers are something that is not easily adaptable to the rest of Unity. This is a little ironic, because OnGUI rendering is a part of Unity itself. These kind of renderers were created at first, because this was the quickest way to get everything working. Many were happy of that, and then with some more experience and feedback I could start working on mesh renderers. These are easily adaptable to many scenarios and are working along with the camera settings.

    About the feature. Sure, I will add this to EBT, but currently I am receiving large feedback with feature requests ;-) If you're able to write mentioned script by yourself, then you're set to go. If not, I will add this as a feature. I am listing all requested features on my Redmine, so I won't lose it! The question is how is your time frame?

    P.S. Energy Bar Toolkit 2.0 has just been sent to the Asset Store. Introducing sequence renderer, and free positioning in 3D space outside the panel.

    Cheers!
    Piotr
     
  39. ojuzu

    ojuzu

    Joined:
    Jun 29, 2006
    Posts:
    67
    Great news, Piotr! I've been holding off on updating my unit health bars for this update. Does this update include draw call optimizations for mesh bars? I've been using the NGUI integration but it'd be less messing if I could just go the mesh route.

    Dennis
     
  40. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Ahh yes!
    Atlas support is a number one feature for 2.0. How I could forget to mention it ;-)

     
  41. ojuzu

    ojuzu

    Joined:
    Jun 29, 2006
    Posts:
    67
    That number 1 is a beautiful thing!
     
  42. fieldrequired

    fieldrequired

    Joined:
    Feb 26, 2014
    Posts:
    108
    Not essential now, coded both features myself - nice code btw, nice to know that i've attached well written plugins to my projects :)
     
  43. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Thank you!

    Working on these kind of projects is essential to keep the code in good shape, so I can focus in adding new features instead of fixing issues on poorly-maintainable code. I have this particular stage of my carrier mostly behind me ;-) There are some design patterns in Unity3D that I didn't understand at first, but I am constantly fixing some of my mistakes in my existing tools.

    Please imagine my surprise when I've discovered how difficult is to update MonoBehaviours without breaking any project of my clients ;-)

    Cheers!
    Piotr
     
  44. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Hi Piotr,

    could you explain a bit the new features that will ship with the next update? Like 3d world positioning? Isn't it already posible?
     
  45. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Yes, it is! But while we were working on this video we found out that it is not simple as it should be. With Energy Bar Toolkit 2.0.0 you can attach your bars to other objects in the hierarchy (without Anchor functionality). In other words bars can be created outside the panel and they may exists anywhere on the scene! The panel is needed though, because it is the renderer.

    I will create w tutorial for this kind of positioning in a next few days.
     
  46. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Great! More easier for us that way! Thanks
     
  47. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    You know what? Energy Bar Toolkit 2.0.0 is here!

    Finally, long anticipated by many, it’s here! Energy Bar Toolkit 2.0.0! Say hello to atlases support!

    New Features
    - Atlases support
    - Bar renderers can be moved and instantiated outside the panel
    - New mesh sequence renderer

    Bug fixes
    - Mesh filled: Wrong smooth speed when burn effect was enabled
    - Mesh filled: Burn texture setting was ignored

    Read more about new features here!


    And here's presentation/tutorial video of 3D positioning:
     
  48. ojuzu

    ojuzu

    Joined:
    Jun 29, 2006
    Posts:
    67
    Interesting... So the anchor is not required? Or is it only required for 2D health bars?

    I was updating my health bars with EBT 2 last night and I found that if I copied the parent object into the anchor property I got a consistently placed health bar that always stayed below my character (or wherever I put it) regardless of the camera angle. It's a HUGE improvement over the old anchoring system and something I struggled with in the last version of EBT.

    Also, with the new atlasing features it seems like the only time it'd be advantageous to use an NGUI anchor was if you needed a progress bar to be integrated with your NGUI UI, right?

    Awesome stuff!
     
  49. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    That's right! Anchoring was needed when 2D <-> 3D transformation was necessary. Now it's not ;-)

    If I remember correctly, you told me about this. This was the reason why I've implemented this feature. Also I want to improve it further to make 3D GUI creation even easier by adding some wizards and stuff, but one thing at time.

    That is correct.
    Thank you! :)

    Cheers!
    Piotr
     
  50. ojuzu

    ojuzu

    Joined:
    Jun 29, 2006
    Posts:
    67
    Awesome, thanks for that Piotr! It is very much appreciated. :)

    Now the last remaining hurdle is depth issues... Any suggestions as to how to keep the EBT health bars from being drawn in front of my NGUI UI?

    Thanks again!

    Dennis