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
    Hello,
    Yes, it is possible. EBT is doing its best to minimize the need of allocations, but there should be some small allocations that are very hard to prevent. How big allocations are you seeing?

    P.S. Please profile your game on your target platform, because there are additional allocations in Unity editor that does not happen on built game.

    Cheers!
    Piotr
     
  2. guzzo

    guzzo

    Joined:
    Feb 20, 2014
    Posts:
    79
    Thanks for the reply. I am experiencing between 0.2 and 0.5 Kb alloc per frame in Editor (Total 4Kb) and a total of 1.4 Kb profiling directed from the device. I was trying to adapt the code but I couldn't find the root of the allocations (didn''t dedicate it much time).

    Can you point me the actions that cause the alloc per frame please. Thanks!
     
  3. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    502
    Bump
     
  4. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    502
    Hi I noticed that when I add a text label attached to the UGUI bar as instructed in the instructions it still shows up on the GUI when the world space bar FollowObject is behind the main camera? Is there a way to prevent it from appearing like the bar? Must be because the text in the demo scenes doesn't do this...

    Edit... I was wrong. In the demo scenes if I add a text label to the prefab it will still appear on the canvas when behind the camera...
     
    Last edited: Jul 19, 2016
  5. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    @christougher Hi! The feature you've requested is not ready yet. I will let you know as soon as it will be available. I'm sorry, didn't have the time lately. About the issue, could you please send me some screenshots to support@madpixelmachine.com?
     
  6. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    502
    Sent, also I got it running with Playmaker without too much fuss so no worries! But it would be a terrific improvement to what is already a stellar asset! Especially for the non-scripty types too cheap for playmaker.
     
  7. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    176
    Using Unity 5.4.0f3 (64-bit) I have this error. (all was ok using previous version of Unity3D).

    "Assets/Energy Bar Toolkit/Scripts/uGUI/Editor/EnergyBarUGUIInspectorBase.cs(109,65): error CS0246: The type or namespace name `MadGUI' could not be found. Are you missing a using directive or an assembly reference?"

    Can you help me ? TNX !
     
  8. genail

    genail

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

    I just downloaded 5.4.0f3 and I couldn't reproduce that error. Please try re-importing EBT. There's a possibility that one or more files has got missing in the process.

    Piotr
     
  9. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    176
    TNX upgrading to 3.09 (dll updates) solved the problem. TNX !
     
  10. coolstorybro

    coolstorybro

    Joined:
    Jun 21, 2015
    Posts:
    3
    Hi, currently using Unity 5.4.1 and bars don't seem to work. Am I doing something wrong? When I drag the "Value Current" slider around the bar doesn't change anymore. I know the value is changing because if I have a text label that says the value it updates properly, but the sprite (filler part) of the bar isn't changing. ?_?

    I tried reimporting and that doesn't seem to help. The strange thing is I opened the example scene and some of the bars work (the clock one, the sparkle one, and the hearts) but the rest don't. They just are stuck.

    I'll send u an email. I can send u my scene too.
     
  11. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    This is usually caused by using outdated version. The latest one in the asset store should work fine. Please re-download it and re-import into your project. Just to be safe, please remove your previous EBT installation.

    Piotr
     
  12. coolstorybro

    coolstorybro

    Joined:
    Jun 21, 2015
    Posts:
    3
    Thanks, got it working!!! Had to remove the previous EBT installation :D
    Thanks for fast response
     
  13. Blackbox514

    Blackbox514

    Joined:
    Apr 8, 2016
    Posts:
    22
    Hi,

    I was wondering if there was any progress regarding TextMeshPro support? If not, can someone kindly tell me where I could make the one-line change mentioned in an earlier post (586 I think)? Thanks!
     
  14. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Unfortunately I won't be offering TMP support anytime soon. I believe that the change mentioned in the post before was replacing public Text label; with public TextMeshPro label;

    Never tested it and I'm not sure if this would be sufficient.
     
    Blackbox514 and hopeful like this.
  15. Blackbox514

    Blackbox514

    Joined:
    Apr 8, 2016
    Posts:
    22
    No worries, I'm sure you already have a lot on your plate. Thanks for the quick reply!
     
  16. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Oh I'm sorry, I forgot to mention the file and line. It is EnergyBarUGUIBase.cs line 21.
    Thanks :)
     
    Blackbox514 and hopeful like this.
  17. Blackbox514

    Blackbox514

    Joined:
    Apr 8, 2016
    Posts:
    22
    No problem, I figured that part out on my own. :)

    That's pretty much all it took btw. Thanks again!

    -Y
     
  18. reese01

    reese01

    Joined:
    Oct 21, 2014
    Posts:
    21
    Bar follow object is not possible with NGUI? I am getting an error about object placement under a canvas which indicates uGUI only. Other than that the asset is great and working nicely!
     
  19. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi!
    Hmm, I've never tested that kind of scenario. Unfortunately most probable the answer is no. I strongly suggest switching to uGUI if this is an option for you :) Heard that it has some issues with mobiles, but maybe Unity 5.5 has introduced some optimizations on that matter.
     
  20. reese01

    reese01

    Joined:
    Oct 21, 2014
    Posts:
    21
    That's precisely the reason why I dislike uGUI.

    How would I go about creating an energy toolbar which has a different size or sprite at both ends but the center bar is always the same?

    For example:

     
  21. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi!
    I believe that filled bar would be the best :) It can have irregular shapes:



    Please let me know if you will need any help!
     
  22. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    72
    Hi,

    I'm getting a strange issue that I don't quite understand. I have a uGUI energy bar that sits above an enemy on a world space canvas. At an FOV of 70 everything appears to be fine, but if I change the FOV to anything else the position of the bar gets... distorted (for lack of a better word) by the movements of the camera.

    Here's a gif of it in action.

    Do you have any idea what's going on here?
     
  23. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hello Lork.

    Oh, I believe that my script is not handling the FOV correctly :)
    Please send me an email with invoice no. to support@madpixelmachine.com and I will send you the patched version ASAP.
     
  24. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    @Lork Actually I just tried and I cannot reproduce this issue. Could you please send me a minimal example scene that will reproduce that issue?
     
  25. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    72
    I can't seem to reproduce it outside of the scene in my game. Further testing has revealed that all uGUI objects in world space behave this way, so the problem isn't EBT.

    I'm completely baffled right now. Do you have any idea what might cause this?
     
  26. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    I wonder...
    Maybe try creating a completely new canvas object? Maybe something is wrong with it?
     
  27. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    72
    I figured it out! The problem was that the energy bars, like all uGUI objects, default to being on the UI layer and were being rendered by a separate UI camera as a result. When I would change the FOV on my main camera without doing the same for the UI camera, this issue was the result of the discrepancy.

    Sorry for the trouble and thanks for humoring me, I guess!
     
  28. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hey Lork,
    Oh, it's so obvious that I feel ashamed for not thinking of that... Anyway I'm happy that you solved it! :)

    Cheers!
    Piotr
     
  29. Runstopper

    Runstopper

    Joined:
    Jun 21, 2015
    Posts:
    1
    Hello, Documentation for Playmaker support shows several actions that don't show up in my list. Am I missing something? Particularly I would like to use Set Bar Min Max Value. Any help is appreciated.
     
  30. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi!
    Have you installed PlayMaker Integration unity package that comes with the Energy Bar Toolkit itself? You should be able to find it inside Energy Bar Toolkit directory.
     
  31. BryanO

    BryanO

    Joined:
    Jan 8, 2014
    Posts:
    173
    Has anyone got a script to change the color of the bars based on networked teams? For example if you are on my team your bar is green - If you are on the enemy team your bar is red.
     
  32. jococo

    jococo

    Joined:
    Dec 15, 2012
    Posts:
    232
    Howdy! :)

    Errors on import into Unity 5.5.3.

    "Assets/Energy Bar Toolkit/Scripts/EnergyBarBase.cs(656,44): error CS0066: `EnergyBarBase.Notify.eventReceiver': event must be of a delegate type"

    "Assets/Energy Bar Toolkit/Scripts/3DRenderers/RepeatedRenderer3D.cs(107,36): error CS0066: `EnergyBarToolkit.RepeatedRenderer3D.onIconShow': event must be of a delegate type"

    Suggestion?
     
  33. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hey guys. Sorry for the delay - holidays :)

    @jococo Hmm that's strange. Do you have any other assets imported? Do you see the same issue when you try to import Energy Bar Toolkit into an empty Unity project?

    @BryanO You can easily set the bar color by accessing EnergyBarBase "tint" property, but unfortunately I don't have any networking logic example code.
     
  34. jococo

    jococo

    Joined:
    Dec 15, 2012
    Posts:
    232
    @genail I dont see any error on new project but I can't simply start my project over.

    Is this a conflict with an existing asset?

    Can this be solved?
     
  35. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    @jococo Whoops, I was sure that I replied you yesterday, and today I don't see my post. Maybe I forgot to post it :)

    Yes, it can be solved, but we have to identify what is the cause of this error. Could you please try importing your assets one after another into that new project? If this error will appear again you will know that the most recent asset caused this issue. Please get back to me with this info to support@madpixelmachine.com. I will handle it from there :)
     
  36. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,221
    Hi, problem here, I want the bar to follow the object in 3d but also render in 3d. Meaning, it should hide if i'm hiding behind objects. Right now, the bar is following the object but if the object hides behind a mountain, you can still see the bar rendered in front of the mountain.

    Any ideas how to solve this?
     
  37. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hello!
    Yes. Please see an example scene called Follow - World Space. You can set up if bars are rendered on screen or world space in the Canvas settings. Please let me know if you will have any issues with that :)

    Cheers,
    Piotr
     
  38. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    502
    Hi, I have a performance issue with the RepeatedRendererUGUI script... I have a canvas that has a total of 7 Repeated Renderers. The canvas itself is usually disabled (the component not the GO). Even when the canvas is disabled the performance hit every frame is significant. Total they get 3.0kg of garbage every frame with 1 MS of processing under Canvas.SendWillRenderCanvases

    Any way to mitigate this garbage collection and jump in processor consumption? Thx...
     
  39. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    I'm sorry, I did not receive a notification for some reason about your message.

    1, Are you profiling the scene on your target device? Editor is generating additional garbage.
    2. Could you please send me the screenshot of profiler window to support@madpixelmachine.com ?

    Thanks!
     
  40. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,221
    Hi, I removed all dlls and tried to compile the included source code. Error: Missing MadGUI all over. Where is MadGUI included? It seems to be missing
     
  41. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi,
    I've just replied you by e-mail :)
     
  42. ScottSummers

    ScottSummers

    Joined:
    Jul 12, 2015
    Posts:
    27
    I love the Energy Bar Toolkit, thank you!

    When I change the value of an energy bar while it's inactive, once it's activated, it then displays the old value for one frame before updating.

    Is there a way around that?

    (This happens when using either valueCurrent = x, ot SetValueCurrent(x).
     
  43. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi!
    Thanks! :) I'm glad you find my asset useful!

    The issue of yours depends on your script execution order.

    Make sure that the bar renderer script of your choice is set with lower order number than the script that it's enabling the bar. The reason why you're seeting the old value can be something like this:

    - unity rendering
    - ebt update() (disabled)
    - your script setting the new value and enabling the bar
    - unity rendering (you see the old value now)
    - ebt update()
    - unity rendering (new value)

    Refer to script execution order settings: https://docs.unity3d.com/Manual/class-ScriptExecution.html It should be working like this:

    - unity rendering
    - your script setting the new value and enabling the bar
    - ebt update() (disabled)
    - unity rendering (new value right from the start)

    Cheers!
    Piotr
     
    ScottSummers likes this.
  44. ScottSummers

    ScottSummers

    Joined:
    Jul 12, 2015
    Posts:
    27
    Thanks for the explanation, but I haven't been able to fix it.

    Does this look right to you?

    Edit / Project Settings / Script Execution Order:

    MyScript -100
    EnergyBar -99
    FilledRendererUGUI -98
    EnergyBarRenderer -97

    Default Time 0.

    (Are each of these 3 EBT scripts necessary to include in this script execution order?)
     
  45. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    It actually does, hmm...
    I will try to reproduce that today/tomorrow on my machine and I will get back to you with the results.
     
  46. GuinUK

    GuinUK

    Joined:
    Feb 27, 2017
    Posts:
    44
    Hi there,

    I recently bought the package and have just found the orbs that were a free download on the website from the medieval pack.

    I'm struggling to integrate them - the test scene works but can't seem to copy it to put it in my own game.

    Any guide?

    Thanks in advance.
    Guin
     
  47. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hi!
    I'm sorry, I forgot to upgrade these bars :/
    Please use the attached unitypackage file. You fill find bar prefabs within :)

    Piotr
     

    Attached Files:

    GuinUK likes this.
  48. GuinUK

    GuinUK

    Joined:
    Feb 27, 2017
    Posts:
    44
    Fab nice one mate.

    Worked like a dream!
    I've left you a 5 star review by the way


    health bar.png
     
    Last edited: Jun 24, 2017
    genail and hopeful like this.
  49. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Great! Thank you! :)
     
  50. GuinUK

    GuinUK

    Joined:
    Feb 27, 2017
    Posts:
    44
    The playmaker addon doesn't work well.

    I get the int reading a value as shown, but the Set Bar Value has lost it's 'update every frame' bool.

    health.jpg

    Or have I done something wrong?

    health.png

    Cheers,
    Guin
     
    Last edited: Jul 5, 2017
unityunity