Search Unity

Energy Bar Toolkit - 2D and 3D Progress Bars

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

  1. DavideA

    DavideA

    Joined:
    Oct 14, 2013
    Posts:
    2
    Hi,
    can I suggest you to do a small change in the EnergyBarFollowObject.cs?
    In the Update function there is:
    Code (CSharp):
    1.             if (cameraReference != null && canvas != null) {
    2.                 if (canvas.renderMode == RenderMode.WorldSpace && lookAtCamera) {
    3.                     energyBarBase.transform.rotation =
    4.                         Quaternion.LookRotation(energyBarBase.transform.position - cameraReference.transform.position);
    5.                 } else {
    6.                     energyBarBase.transform.rotation = Quaternion.identity;
    7.                 }
    Replace the line
    Code (CSharp):
    1.  
    2.                     energyBarBase.transform.rotation = Quaternion.identity;
    with
    Code (CSharp):
    1.  
    2.                         energyBarBase.transform.rotation = Quaternion.Euler(barRotation);  
    3.              
    Where barRotation is defined as :
    Code (CSharp):
    1. public GameObject followObject;
    2.     public Vector3 offset;
    3.     public Vector3 barRotation;
    So, if we don't want to use the LookAtCamera flag, we can set our rotation.
    I've done that, because I wished to show a circular bar under the feet of the player, but it was impossible to rotate it. Is there another way to do it that I've missed?
     
  2. genail

    genail

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

    I think that your modification is actually the best way to achieve this. Thanks, I will include this in the next release :)

    Cheers!
    Piotr
     
    hopeful likes this.
  3. diegoadrada

    diegoadrada

    Joined:
    Nov 27, 2014
    Posts:
    59
    Hi Piotr!
    I'm using the Repeated Renderer UGUI, my bar has 200 Value Max, and i want the color changes when the value is less than 100.
    I'd like to know if it's possible to modify the Icon Color field from script?
    Thanks.
    barcolor.png bar2.png
     
  4. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi!
    I think that the easiest way to achieve this may be by changing Bar Color Type to Gradient and setting up a sharp edge gradient. It's not very clean solution, so if you want to do it by scripting you can do something like this:
    Code (CSharp):
    1. if (barObject.GetComponent<EnergyBar>().valueCurrent < 100) {
    2.     var renderer = barObject.GetComponent<FilledRendererUGUI>();
    3.     renderer.spriteBarColor = Color.blue;
    4. }
    Hope it helps! :)
    Piotr
     
  5. DJVDJV

    DJVDJV

    Joined:
    Sep 11, 2014
    Posts:
    70
    Hellos,

    I want to draw enegy bar to same layer with NGUI with optional dept sets.

    In my project EnebyBarToolkit and NGUI are both in same layer called "UI".. and I have only 1 "UI camera" at NGUI:s root. No different camera for Energy Bar toolkit.

    Now all works great.. until:

    Energy bars are always drawn top of NGUI objects. I try change Energy Bar toolki NGUI Anchor Depth.. but it does not affect.. even with -20 it is always top.

    What I have don wrong? How to fix it?

    PS. Tried register Mad Pixel Machine forums with my invoicing number but I only get response "Invalid user or password" when I try log in.
     
    Last edited: Sep 7, 2015
  6. genail

    genail

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

    Unfortunatelly this is a limitation of NGUI integration. NGUI is using its own rendering subsystem and there's nothing that I can do about it:

    http://energybartoolkit.madpixelmachine.com/doc/latest/tutorial/ngui.html

    There's a trick that you can perform. If you will distable the UI Root, create another 2D UI with new camera then all widgets on the second UI Root can be painter above EBT bars. All you need to do is adjust depth, clear flags and probably layers :)

    Please let me know if you will have any issues with it!

    Cheers!
    Piotr
     
  7. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    Hi,

    Earlier in the thread, someone mentioned getting the text part of EBT to work with Text Mesh Pro by changing a line of code. While that's certainly possible for me to do, I'd have to make the same change every time I updated EBT.

    Since Text Mesh Pro is a popular text asset, would you consider adding a field for the Text Mesh Pro UI Text component alongside the Unity UI Text component reference?
     
    hopeful likes this.
  8. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi Korindian,
    Can you give me the link to this particular post?
     
  9. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
  10. guzzo

    guzzo

    Joined:
    Feb 20, 2014
    Posts:
    79
    Bars stopped working after upgrade to Unity 5.2. Did something go wrong during my project upgrade or is it a known issue?
     
  11. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Thanks, I will contact the author :)

    Please upgrade to 3.0.6. It has been fixed in this release :)

    Cheers!
    Piotr
     
  12. guzzo

    guzzo

    Joined:
    Feb 20, 2014
    Posts:
    79
    My bad, thanks!
     
  13. lenzchu

    lenzchu

    Joined:
    Dec 7, 2013
    Posts:
    15
    Hi there ^^ Sorry if i keep finding that Radial bar bug. But I've encountered the same bug since last update. It was fixed before that xD It's till now i had some time to find the culprit of this bug.

    If you set the Offset to anything but 0 like 0.5 in my case, and turn on the burn effect, you'll see the burn bar isn't handling the offset and length correctly :(
    In the image below, that red bar shouldn't do that lol I even tried it with a fresh new bar with nothing connected and just scrubbing the value.
    Thanks for taking a look at this if u can!
     

    Attached Files:

    Last edited: Sep 22, 2015
  14. kdavis9181

    kdavis9181

    Joined:
    Jul 5, 2015
    Posts:
    4
    Hello,

    I am receiving the following error while attempting to use the NGUIEnergyBarToolkit:
    Assets/Energy Bar Toolkit NGUI/EnergyBarToolkitNGUIAnchor.cs(16,43): error CS0246: The type or namespace name `UIWidget' could not be found. Are you missing a using directive or an assembly reference?

    It is referencing the following: public class EnergyBarToolkitNGUIAnchor : UIWidget {

    My question. Is the namespace correct?
     
  15. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    @lenzchu: Please enable conversations or write to me to support@madpixelmachine.com with your invoice no. I will send you the patched version :)

    @kdavis9181 Do you have NGUI in your project? If not, please do not unpack NGUI integration package and remove previously unpacked folder. It will only compile if you have NGUI imported.

    Cheers!
    Piotr
     
  16. kdavis9181

    kdavis9181

    Joined:
    Jul 5, 2015
    Posts:
    4

    Thank you for the fast response. I will give this a try and I will let you know the outcome!
     
  17. JayJennings

    JayJennings

    Joined:
    Jun 24, 2013
    Posts:
    184
    I'm trying to use the SimpleEvent system and have attached that script to a pickup item. But I'm not able to drag-drop my created Health Bar game object from the hierarchy into the Energy Bar slot of the script on the pickup item. The slot never highlights for me to drop it.

    I created the Energy Bar by right-clicking in the Hierarchy and choosing UI > Energy Bar Toolkit > Filled Bar.

    The health pickup item is a prefab that gets instantiated during the game -- is that problem that I can't fill the slot of a prefab? If that's the case do I fill that slot via script every time I instantiate one of the pickup items?

    Jay
     
  18. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello @J. A. Whye

    SimpleEvent is working only with instances, you cannot assign a prefab to this script, because it won't know what bar instance should be used. SimpleEvent can be used with bars instantiated at the runtime, but you have to connect this new bar instance to SimpleEvent bar field.

    It should look like this (script attached to the same object where the spawner is)

    Code (CSharp):
    1. public SimpleEvent event; // if can be assigned here
    2.  
    3. void Start() {
    4.     event.energyBar = GetComponent<EnergyBarSpawnerUGUI>().instance;
    5. }
    Cheers!
    Piotr
     
    JayJennings likes this.
  19. beNice

    beNice

    Joined:
    Sep 12, 2014
    Posts:
    28
    Hey, Piotr. We love EBT and the included Playmaker actions.

    Would it be at all possible to get a Filled Renderer UGUI with an Energy Bar that uses floats instead of integers?

    With integers the burn is very smooth but our return value is constantly increasing so we cannot get a smooth recovery, even with percentage, and we need to be able to perform various easing ramp patterns for the value.

    Thanks for your great work.
     
  20. genail

    genail

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

    Energy Bar Toolkit is using integers internally. You can do a simple trick to work with floats.
    1. You have to multiply your bar min and max values. Let's say you want a bar from 0 to 100. Multiply it by 100 and set it from 0 to 10000 then.
    2. You want to set it's value to 95.5 (float). Multiply this float by 100 and convert to int. (Convert Float To Int Playmaker action). You will get the value of 9550.
    3. Set this value to your bar.
    If you will find it difficult, I can create a working example for you :)

    Cheers!
    Piotr
     
  21. beNice

    beNice

    Joined:
    Sep 12, 2014
    Posts:
    28
    Thanks for the quick reply. That would work just fine.

    Might you have an easy solution for the text portion: {cur}/{max}?

    Have a great day.
     
  22. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi!
    I'm sorry for responding so late. Tough pre-holidays weekend :)

    Please write to me to support@madpixelmachine.com with your invoice no. I will send you a version with some new formatting options :)
     
  23. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    Hey there,

    I still really like the Energy Bars, but I think my suggestion from a long time ago got lost (you had replied to it though)

    Would you be able to put all the depreciated examples and whatnot, in their own subfolder, so that when the asset is updated, we only need to uncheck 1 folder instead of digging through each and deselecting a number of legacy items?

    Just a minor thing really, but thanks for the great asset!
     
  24. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Oh, I'm sorry. I believe it really got lost because it is nothing difficult to do. I will move these in a moment, so with the next update it will be in a single subfolder :)

    Edit: I will leave _Deprecated directories within bar packs, because otherwise these may be difficult to find.

    Cheers!
    Piotr
     
    Last edited: Dec 29, 2015
    hopeful likes this.
  25. RodatGHG

    RodatGHG

    Joined:
    Jan 23, 2014
    Posts:
    9
    Hi

    Can you please help us, we are using Energy Bar Toolkit in our project but receive the following error each frame in the Unity editor. We are using an older version of Energy Bar Toolkit that we integrated a while back. The error message has always been there.

    We have already integrated EBT into our project , upgrading to the very latest version may not be practical : )

    Any help or advice would be greatly appreciated, thanks.



    NullReferenceException: Object reference not set to an instance of an object

    EnergyBarToolkit.MadPanel+<AllSpritesForScreenPoint>c__Iterator3.MoveNext ()

    System.Collections.Generic.HashSet`1[EnergyBarToolkit.MadSprite]..ctor (IEnumerable`1 collection, IEqualityComparer`1 comparer)

    System.Collections.Generic.HashSet`1[EnergyBarToolkit.MadSprite]..ctor (IEnumerable`1 collection)

    EnergyBarToolkit.MadPanel.UpdateMouseInput ()

    EnergyBarToolkit.MadPanel.UpdateInput ()

    EnergyBarToolkit.MadPanel.Update ()


    Many Thanks

    RT
     
  26. genail

    genail

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

    Looks kinda strange... I'm looking into the code and I cannot see anything that may be causing this :/
    Is there any chance that you can switch to Unity UI (uGUI) bars? http://energybartoolkit.madpixelmachine.com/doc/latest/components/renderer_types.html

    The Mesh Bars that you're using are now deprecated. Still this is a strange issue that I first heard off...

    Cheers!
    Piotr
     
  27. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Last edited: Feb 9, 2016
  28. genail

    genail

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

    Please import the PlayMaker Integration package that is included in Energy Bar Toolkit package itself. The one on the web page is from the times when PlayMaker package was distributed separately and it's kinda outdated :)

    Cheers!
    Piotr
     
  29. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Hi this asset looks interesting, but do you happen to know if it's compatible with Ice Creature Control and GameFlow? Thanks
     
  30. genail

    genail

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

    EBT bars are completely based on Unity UI (with custom rendering code) so if these two assets are working fine with Unity UI, Energy Bar Toolkit should be working fine with those too. Yet I cannot guarantee that everything will be working 100% well, because I don't know these assets.

    Cheers!
    Piotr
     
    jonfinlay likes this.
  31. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Thanks, I bought it anyway although haven't had chance to properly test it yet. Pit the developer of Ice Creature Control often makes plug and play adapters for 3rd party assets, so hopefully he'll be able to make one for this. The two hopefully should work fantastically together.
     
  32. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Suggestion...

    I just picked up EBT on sale and absolutely love it. I'm thinking of swapping it in for my previous world space health bars done with X-Bars except for one issue. X-bars is really easy to link to the health script of my enemies, I just have to drag and drop the gameobject into a slot, define the name of the c# health variable within the script and it picks it up. Please consider adding this type of functionality as it makes it soooo much easier to get things going. Nothing beats drag and drop...
     
    RoyalCoder, hopeful and jonfinlay like this.
  33. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    I like this idea too, I originally thought this was implemented, shame it isn't.
     
  34. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Yes I was actually surprised with how many features are jam packed in here it isn't already there. :)

    Also another suggestion to be able to make these bars absolutely insane! (okay maybe that was a little too dramatic...) but what about also having the option to apply the same type of effects to the both the foreground and background sprites. This opens up the world to all sorts of possibilities... As is some of this functionality can be managed with two sliders one on top of the other... or having a render texture behind the main sprite... I'm getting a bar to look like flowing liquid metal representing the health (using tiling) and animated firey smoke to show in the empty part of the bar (using a render texture behind... gets tricky tho... :)
     
  35. genail

    genail

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

    It's a great idea! I don't know why I didn't came up with this. Thanks! :)

    P.S. I will think also about the effects. Thank you for the suggestions!

    Cheers!
    Piotr
     
    RoyalCoder likes this.
  36. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Hello,

    I have a big issue with your asset! Android build needs for your asset "full network access". Mostly WWW instances cause this issue, but in your source code are no such instances. I guess, this instances are in the DLL files. Could you tell us for what do you need them? Can we have the source code for the DLL files?

    Im trying to wipe out all "full network access" premission sources for my mobile game, because Unity let us down, as usual, we have to spend days to find out what causes the "full network access" premissions for android. You are one of them, which cause this premission.

    Is this bug known, did you already fixed this?

    I cannot tell you what version it is, because there is no document in your directory, which shows the version. The version is about 3-4 month old.

    Thanks in advance.
     
  37. genail

    genail

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

    DLLs can be removed if you're using Unity UI bars. If you're not using mesh bars, I can prepare a striped version just for you. Please write to me with your invoice no. to support@madpixelmachine.com.

    Cheers!
    Piotr
     
  38. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    In 3.0.9 still available.
     
  39. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    You have 4 DLLs: Mad2D_Editor.dll, MadCommons_Editor.dll, Mad2D.dll, MadCommons.dll

    I was trying to remove Mad2D.dll, MadCommons.dll, but too much scripts have dependencies with these DLLs. I will send an e-mail.
     
  40. PixelKnights

    PixelKnights

    Joined:
    Feb 24, 2016
    Posts:
    15
    In the example video, there's a clip where the energy bar and ammo bar follows the player underneath them, is this easy to achieve and is there a sample to have these 2 bars included?
     
  41. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello!
    It should be as easy as using a single bar to follow a game object. You can set up your bars to be a child of an empty object and set this empty object to follow your 3D object. Unfortunately I don't have any video tutorial, but let me know if you will have any issues with this setup!

    Cheers!
    Piotr
     
  42. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Hi, just wondering, any chance of this feature of this getting implemented? Would be wonderful to have a prefab with the health script/variable referenced and have the spawned health/energy bar set itself up with max health/current health with no fuss. :)
     
  43. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi @genail ,

    I'm wondering if for any chance you can add support for this shader to be used with EBT?
    Thanks!
     
  44. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Sorry for the delay guys. I was on vacations :)

    @christougher Sounds great :) I will have to inspect that a little further.
    @D0R1N Oh, I love it! I added to my TODO list. I won't do it soon, but I won't forget about it either :)
     
    RoyalCoder and Bhanshee00 like this.
  45. Unlimited_Energy

    Unlimited_Energy

    Joined:
    Jul 10, 2014
    Posts:
    469
    I am not fully understanding the requirements to create a grid of textures. Are there spacing requirements when creating a "grid" of textures in photoshop. You show and say in the video to just select the grid width and height but I cannot figure out what the specifications should be. I cannot figure out how the script separates your grid intelligently. can you create a video of making a grid? Its kind of a vital portion of understanding the sequence renderer tutorial.
     
  46. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi!
    That's really simple. If you're specifying that grid is for instance 4x4, it is divided equally. So texture of size 256x256 will be divided into 64x64 parts. It's a good idea to leave couple transparent pixels of spacing, because if texture will be scaled, you may see texels from parts next to the one that you're currently seeing.

    Hope it helps!
    Piotr
     
    Unlimited_Energy likes this.
  47. Unlimited_Energy

    Unlimited_Energy

    Joined:
    Jul 10, 2014
    Posts:
    469
    I just cannot figure out the Ugui way of setting up Sequence Renderer. Any way for you to make a new video for the Ugui in new unity5? No matter what i do i cannot get the progress bar to appear and i know its something I am not following right,
     
  48. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi!
    There's no video but the setup is fairly the same as for other uGUI bars. Just create a canvas and then add the bar.
    Here's a gif for you :)

    fdb9e3a2fb682dbb7c2f2018a82c8b44.gif
     
    RoyalCoder likes this.
  49. Unlimited_Energy

    Unlimited_Energy

    Joined:
    Jul 10, 2014
    Posts:
    469
    ahh good deal. i have the progress bar up and going. 64 frames.
     
  50. guzzo

    guzzo

    Joined:
    Feb 20, 2014
    Posts:
    79
    Hello. I am using a Filled Renderer UGui Bard and there is some memory allocation per frame. Is it possible?
    Thanks