Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Energy Bar Toolkit - 2D and 3D Progress Bars

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

  1. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    OK I will let you know when I will have something! :)
     
  2. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi @vamky ! What do you think of this one? I will send you the link to the package in a moment :)

     
  3. vamky

    vamky

    Joined:
    Aug 9, 2014
    Posts:
    70
    Wow! This is great! I will try it out asap!
    Thank you!
     
  4. GarbageCat

    GarbageCat

    Joined:
    Jul 31, 2012
    Posts:
    228
    Great update,
    I wish the other assets would be updated and maintained like EBT does.

    unity should really add this as part of their default UnityUI
     
    genail likes this.
  5. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Thank you for your kind words :)
    I highly doubt that Unity Technologies will hire me, but that would be something! ;-)

    Cheers!
    Piotr
     
  6. lenzchu

    lenzchu

    Joined:
    Dec 7, 2013
    Posts:
    10
    thanks for the many updates! I wanna report another bug I found. In radial CW's Burn, it doesn't retain it's Offset and Length of the Radial bar's grow direction! ^^
     
  7. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Oww... you're right!
    Thank you for reporting this! I will fix this with the next release :)

    Cheers!
    Piotr
     
  8. diegoadrada

    diegoadrada

    Joined:
    Nov 27, 2014
    Posts:
    55
    Hi, I bought this asset and want to know if it is 100% compatible with Unity 5? Thanks!
     
  9. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi!
    Yes it is :) We even have a WebGL demo! Check it out!

    Cheers!
    Piotr
     
  10. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi! I have one little thing to announce today :)

    Energy Bar Toolkit 3.0.4 has been released!

    New sliced bar type






    Sliced bar is one thing that EBT should have for a long time. It slices bar texture using sprite border settings so the bar's beginning and end look the same regardless of fill value. Sliced bar can be created from the main menu: Tools -> Energy Bar Toolkit -> uGUI -> Create Sliced Bar.

    Repeated bar last icon animations


    If you like to add a little spice to your repeated bar, now you can set the last icon animation! You can simply do this by attaching Repeated uGUI Last Icon Animator script to your repeated bar. You will find a working example in Example 5 scene.

    Script for easy uGUI bars spawning


    Spawning object with attached bars can be difficult because GUI elements (such as bars) should be placed under the Canvas component and other object somewhere away from it. Now spawning the bars is really easy!

    More changes
    New Features
    • Added new example scene (example 6)
    • Created update info window
    • Created new example scenes
    • Added EnergyBarBase.ResetAnimations() for bars pooling. Use it when taking a bar from object pool.
    • PlayMaker: Created SpawnEnergyBarWithSpawner action using new Spawner component
    Improvements
    • Canvas finder does not necessary need to look for the Canvas component
    • Reorganized example scenes
    • Follow object component has new methods of camera and canvas lookup
    Bug Fixes
    • uGUI: Fixed filled burn effect when Grow Direction is set to Radial and Offset/Length is set to any non-default value
    • Fixed Unity 5.1 RecalculateNormals() bug
    • uGUI: Follow object not working when Canvas set to Screen Space Camera
    • uGUI: Invalid follow object position when canvas is set to non-constant pixel size
    • uGUI: Follow object rotation sometimes was invalid
    • uGUI: Bars that are following an object not visible on screen no longer pop-up from nowhere
    • uGUI: Fixed visibility issue with burn effect when increasing bar value
    • uGUI: Removed Fill Direction: Color Change from Repeated Bar (not supported)
     
  11. cg_destro

    cg_destro

    Joined:
    Aug 13, 2013
    Posts:
    142
    very good, thank you! :)
     
    genail likes this.
  12. InfinityCoder88

    InfinityCoder88

    Joined:
    Oct 4, 2013
    Posts:
    282
    Hi @genial ,
    A quick question for you, example (in my case):
    -I'm spawning the energybar in scene when shooting & hitting an enemy
    -How can be linked the instantiated energybar prefab to the specific enemy ?
    Thanks in advance!
     
  13. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi Dorin,
    I am currently on vacations (until next week) but please look at this :)
    http://energybartoolkit.madpixelmachine.com/doc/latest/other/following.html#unity-ui-(ugui)-way
    http://energybartoolkit.madpixelmac...following.html#accessing-spawned-bar-instance

    Cheers
    Piotr
     
  14. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Important notice to all who will need my support during following few days. I'm on vacations 'til next week, so please excuse me if I won't be able to respond to every e-mail or message as usual. @MPM_Qler will try to respond your questions if he will be able to.
     
  15. Mikael-Madrid

    Mikael-Madrid

    Joined:
    Nov 2, 2012
    Posts:
    26
    Assets/Energy Bar Toolkit/Scripts/uGUI/EnergyBarUGUIBase.cs(95,19): error CS1061: Type `Text' does not contain a definition for `text' and no extension method `text' of type `Text' could be found (are you missing a using directive or an assembly reference?)
    Any idea why I'm getting this after importing?.
     
    XCO likes this.
  16. mrm83

    mrm83

    Joined:
    Nov 29, 2014
    Posts:
    256
    HI

    I just got this and was wondering how to prevent a new bar from spawning when i set my game object active?

    ie:
    i have enemy unit that spawns a hp bar.
    when i disable the enemy unit, the hp bar disables as well which is good.
    when i enable the enemy unit, instead of reusing the spawned hp bar, it creates a new one!

    I am recycling my enemy units that is why i am enabling/disabling them.. but the new hp bars per enable is bad..

    update:
    i just updated the onEnable function inside spawn class to something like this.. seems to work.. but don't know if it will mess anything up..

    voidOnEnable() {
    if (!recycle || instance == null) {
    instance = Instantiate (this, barPrefab, canvas, worldCamera, attachPoint, networkInstantiate, networkGroup);
    }

    if (instance != null) {
    instance.gameObject.SetActive(true);
    }
    }
     
    Last edited: Jun 30, 2015
  17. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hello Mikael,
    Seems you have a script called "Text" somewhere in your project and it is conflicting with Unity UI "Text" type. You have to localize that script and rename it, put it in a different namespace or if it comes with another 3rd party asset, write to its author about the conflict.

    Cheers!
    Piotr
     
  18. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Oh gosh... You're right! Thank you for pointing this out!
    Should be working by now as you proposed I think. I will check that out when I will get back from my vacations. Then I will release the official patch :)

    Thank you again!

    Cheers!
    Piotr
     
  19. moure

    moure

    Joined:
    Aug 18, 2013
    Posts:
    184
    Damn was waiting for a sale to buy this one but due to the capital controls in Greece cant complete the transaction. Already have your level manager plugin and its a great one so im sure this will be great too, better luck next time :)
     
  20. InfinityCoder88

    InfinityCoder88

    Joined:
    Oct 4, 2013
    Posts:
    282
    Thanks @genial , I figured out, works like a charm ;)
    P.S Have a great great vacation !!!
     
  21. Datester35

    Datester35

    Joined:
    Mar 30, 2013
    Posts:
    9
    How do you access EnergyBarSpawnerUGUI from javascript?
     
  22. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    InfinityCoder88 likes this.
  23. Datester35

    Datester35

    Joined:
    Mar 30, 2013
    Posts:
    9
    No, I don't think it really helps, sorry.

    Anyways, I was trying to do this, but couldn't really get any further even though I tried working on it for another 2 hours:

    var spawner = GetComponent<EnergyBarSpawnerUGUI>();
    var barRenderer = spawner.instance; // bar renderer allows to access rendering properties
    var bar = barRenderer.GetComponent<EnergyBar>(); // allows to change bar value
    bar.ValueF = 0.5f;

    I figured out that in unityscript, I need to change it to this:

    var spawner = GetComponent("EnergyBarSpawnerUGUI");
    var barRenderer = spawner.instance; // bar renderer allows to access rendering properties
    var bar = barRenderer.GetComponent("EnergyBar"); // allows to change bar value
    bar.ValueF = 1.0f;

    However, it gives me the error that instance is not a member of unityengine.getcomponent

    http://gyazo.com/008874b2a412499bb952fb1c0f608729

    What can I do to make this script work, so that I can change bar.ValueF?
     
    Last edited: Jul 2, 2015
  24. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Please replace GetComponent("EnergyBarSpawnerUGUI") with GetComponent(EnergyBarToolkit.EnergyBarSpawnerUGUI); (yes, without quotation marks).

    The please do the same with the second GetComponent:
    barRenderer.GetComponent(EnergyBar);

    But without namespace this time :)

    Cheers!
    Piotr
     
  25. Datester35

    Datester35

    Joined:
    Mar 30, 2013
    Posts:
    9
    That still doesn't work. Now I get these errors:

    'EnergyBarSpawnerUGUI' is not a member of 'Energybartoolkit'
    Unknown identifier: 'EnergyBar'

    http://gyazo.com/fd27491a23c2647d932e5b7318a95a8a

    Here is the code:

    #pragma strict

    var spawner = GetComponent(EnergyBarToolkit.EnergyBarSpawnerUGUI);
    var barRenderer = spawner.instance; // bar renderer allows to access rendering properties
    var bar = barRenderer.GetComponent(EnergyBar); // allows to change bar value


    function Start () {
    bar.ValueF = 0.7f;
    }

    function Update () {

    }
     
  26. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Have you moved your EBT script to Standard Assets directory as told here? If not, compiler will not recognize EBT scripts at all.

    Edit: this is one of the reasons why it is better to write in C# than UnityScript ;-)
     
  27. TimeCastle

    TimeCastle

    Joined:
    Jan 12, 2015
    Posts:
    32
    I'm new to this asset and I was wondering what the best way to integrate the bar with another value is. For example I have a health script, and I want the bar to go down with my health. I'm sure this is an easy question lol.
    Great asset by the way.
     
  28. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi!
    This may help you :)

    Cheers!
    Piotr
     
  29. Datester35

    Datester35

    Joined:
    Mar 30, 2013
    Posts:
    9
    Ok, thanks, it works now! However, I had to

    Move Energy Bar Toolkit / Scripts/ Ugui/ Editor directory to Energy Bar Toolkit / Editor

    Please update your documentation to include this, as it will save a lot of other people time figuring out what is missing.
     
  30. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    390
    Hi Piotr

    I just picked this asset up and it's really cool.

    I just wondered what is the best way to get a progress/energy bar in 3D because using uGUI it seems to be hard to place?

    I saw some of the old videos and looked at the Energy Bar Renderer but the docs seem to say it is deprecated, so I am wondering what is the best direction to go in here to place bars in 3D space?

    The example 4 in the latest packages shows bars attached to world space, however this is primarily as a status where it is following the object and facing a camera? I am wondering how this can be placed and rotated arbitrarily in 3D space, so any suggestions would be much appreciated :)


    cheers

    Nalin
     
  31. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Ouch!
    I'm sorry. When I've added uGUI integration I forgot to update it. Good that it is working now :)

    Thanks!
     
  32. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi Nalin,

    It's not hard to place EBT uGUI bar in 3D space :)
    I believe that everything you need can be found here.

    Energy Bar Follow Object component will set your bar position in world space and rotate it so it will face the camera. Do you need something else beside that? If yes, please let me know.

    Cheers!
    Piotr
     
  33. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    I'm calling @puzzlekings because Unity forums notifications are not so great :)
     
  34. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    390
    Thanks Piotr

    Yes I have seen that, however I think I need something slightly different.

    Is it possible to place it arbitrarily in 3D space and not have it face the camera? I am using TextMeshPro to build a GUI in 3D, and that component has got two variations - TextMeshPro (which can be placed anywhere in 3D space) and TextMeshProUGUI (placed within a canvas).

    I am wondering whether it is possible for EBT to have the same approach?

    cheers

    Nalin
     
  35. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    There are deprecated mesh renderers, but I would strongly recommend using uGUI bars on a world space canvas. These can be also placed wherever you want but under one condition - it should be under a Canvas in the hierarchy.

    bbb20317-8b8f-4cda-96da-1919c0b71b3e.png

    Then disable Look At Camera option (this option is broken, I will send you updated package in a moment)

    f4373319-1743-4ecf-b031-bdc71c00ba4b.png

    And here it is (two are looking at the camera, one is not).

    31e47bda-284a-41b9-9201-634690802549.png

    Please check your conversations inbox in a moment for the patched version.

    Cheers!
    Piotr
     
  36. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    390
    Thanks Piotr

    Will test it out when back in the office ;)

    BTW I managed to get TextMeshPro working instead of normal Unity Text, just by changing one line (and it looks much better). My suggestion is that if you can somehow build this support in (not sure exactly how, but DoTweenPro does this - but it should not be too hard) then you can say it offers TMPro support and appeal to all the TMPro users.

    Just a suggestion.

    br

    Nalin
     
  37. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    390
    Ok I tested the package you sent me (got a few Unity 5 updating messages).

    Seems to be able to rotate in 3D by deselecting the EnergyBarFollow script, but this is local, so proper positioning in 3D is a little tricky.
     
  38. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    What do you mean by "local"?
     
  39. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    390
    By local I meant that it seems difficult to position in World Space because it is tied to UGUI and to the canvas. This means that while I can position in 3D by changing the positions highlighted below, it is difficult to position it in World space at a specific point. In your case you overcome this by using the FollowObject script because that is the common use case.

    All I am suggesting is that in the future it may be useful to have the ability to position it anywhere in 3D space as well, which is what you had before. Not sure if there is an easy solution here.

    cheers

    Nalin

    EnergyBarToolkit.png
     
  40. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    I understand.

    I think if you switch your Canvas to World Space and set it at 0, 0, 0 position. Then you can treat local coordinates as world coordinates :)

    You cannot draw uGUI bars without a canvas. What you can do is to create one canvas for each bar and move the canvas, but it will generate many draw calls that could be bad for mobile devices.

    I'm trying to understand how disabling EnergyBarFollow script helped you? Did you want to put the bar in a static world position instead of following world object? I thought the issue is the rotation so I fixed the "Look At Camera" option for you.

    Cheers!
    Piotr
     
  41. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi!
    Seems that you have a script or type called Gradient somewhere in your project. Gradient is a type from Unity API and defining it again will create a conflict. If this is your script you can:

    - Rename it
    - Add it to a namespace

    If this is not your script, the best would be if you write to author asking him to fix this.

    Cheers!
    Piotr
     
  42. JTam_HItn

    JTam_HItn

    Joined:
    Dec 13, 2013
    Posts:
    4
    Hi,

    This was the first Unity Asset I've purchased. I'm a noob :(

    Can you point me in the right direction on how to make the Energy Bar function as a countdown timer in C#?

    Thanks!
     
  43. JTam_HItn

    JTam_HItn

    Joined:
    Dec 13, 2013
    Posts:
    4
    I've figured this out (but please feel free to let me know if there's a better way!):

    public classTimer : MonoBehaviour {

    public float timeLimit = 50.0f;
    public float timeLeft = 50.0f;
    public GameObject energyBar;

    void Update () {

    timeLeft -= Time.deltaTime;
    energyBar.SendMessage("SetValueF", (timeLeft/timeLimit)); //divide by timeLimit since this 2nd argument needs to be expressed as a percentage
    }
    }​
     
  44. genail

    genail

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

    If you're writing in C# then you can reference your bar using direct type:

    Code (CSharp):
    1. public EnergyBar energyBar;
    then

    Code (CSharp):
    1. energyBar.ValueF = timeLeft / timeLimit;
    or if you want to count down:

    Code (CSharp):
    1. energyBar.ValueF = 1 - timeLeft / timeLimit;
    Keep learning and have a lot of fun out of it :)

    Cheers!
    Piotr
     
    JTam_HItn likes this.
  45. groo79

    groo79

    Joined:
    Nov 20, 2014
    Posts:
    11
    Hey, I'm using your toolkit for a project and we wanted to build it in WebGL. I keep getting this error when I try to build it though.
    "Assets/Energy Bar Toolkit/Scripts/uGUI/EnergyBarSpawnerUGUI.cs(84,17): error CS0103: The name `Network' does not exist in the current context"
    Any idea how to fix this?
     
  46. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi!
    Ouch! Please open EnergyBarSpawnerUGUI.cs and on lines 39 and 84 replace:
    Code (CSharp):
    1. #if !(UNITY_FLASH || UNITY_NACL || UNITY_METRO || UNITY_WP8)
    with
    Code (CSharp):
    1. #if !(UNITY_FLASH || UNITY_NACL || UNITY_METRO || UNITY_WP8 || UNITY_WEBGL)
    I will apply this for the next patch release.

    Thanks! :)
    Piotr
     
  47. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Energy Bar Toolkit 3.0.5 has been released!
    New bugfix release of Energy Bar Toolkit is here! This version fixes bugs found in the previous release and introduces one new feature.

    NEW FEATURES
    • Blinking effect for uGUI Repeated Renderer
    BUG FIXES
    • WebGL: Fixed compilation errors
    • uGUI: Fixed filled bar follow effect when direction were different than left to right
    • LookAtCamera option of EnergyBarFollowObject component was not working correctly
    • Spawner when disabled and re-enabled was generating another bar instance
     
    hopeful and InfinityCoder88 like this.
  48. InfinityCoder88

    InfinityCoder88

    Joined:
    Oct 4, 2013
    Posts:
    282
    Good news @genial , nice features ! keep up the good work!
     
    genail likes this.
  49. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    Just a minor thing for whenever the next version is released, but could you move all the depreciated stuff into one folder, so we only need to uncheck that to avoid importing them?

    i.e.
    EnergyBarToolkit\Depreciated\<all the depreciated folder paths>

    instead of:

    EnergyBarToolkit\Depreciated
    EnergyBarToolkit\Examples\Depreciated
    EnergyBarToolkit\____\Depreciated

    Would be really nice, thanks, really liking the asset!
     
  50. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi,
    Thank you for the suggestion. I will do that next time :)

    Cheers!
    Piotr
     
unityunity