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. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    75
    No, I'm trying to use this asset together with another RexEngine asset. With out Energy Bar Toolkit, everything works fine with the RexEngine asset.

    Seems like the RexEngine asset already has an EnergyBar script name, the main problem of Energy Bar Toolkit is having a script name EnergyBar, when using it with another complete project asset there's a big chance that it's also using an EnergyBar name class. Any idea or work around to fix this issue?
     
    Last edited: Apr 11, 2019
  2. Lord_Chicken

    Lord_Chicken

    Joined:
    Nov 9, 2017
    Posts:
    4
    Hi.

    I'm using EnergyBarToolkit with Playmaker. (I like EnergyBarToolkit !)
    But, I got two errors with Playmaker Actions for EnergyBarToolkit in Unity 2018.3.
    These errors are as follow.

    (1)
    Assets\Energy Bar Toolkit PlayMaker\Actions\SpawnEnergyBarWithSpawner.cs(70,18): error CS0619: 'Network' is obsolete: 'The legacy networking system has been removed in Unity 2018.2. Use Unity Multiplayer and NetworkIdentity instead.'
    (2)
    Assets\Energy Bar Toolkit PlayMaker\Actions\SpawnEnergyBarWithSpawner.cs(70,18): error CS0619: 'Network.Instantiate(Object, Vector3, Quaternion, int)' is obsolete: 'The legacy networking system has been removed in Unity 2018.2. Use Unity Multiplayer and NetworkIdentity instead.'


    Please teach me how can I solve these errors.

    (I'm not good at English.)

    Version of software used
    Unity 2018.3.14F1
    Playmaker 1.9.0.p16
    EnergyBarToolkit 4.0.3p1
     
    Last edited: May 24, 2019
  3. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    362
    If you updated from pre 4.0 you should delete old version then install the new one.
     
  4. Lord_Chicken

    Lord_Chicken

    Joined:
    Nov 9, 2017
    Posts:
    4
    Thank you for your advice.
    However, that method did not solve the problem.

    I think I need a new updated Playmaker Actions package for EnergyBarToolkit to solve the problem.
     
  5. Lord_Chicken

    Lord_Chicken

    Joined:
    Nov 9, 2017
    Posts:
    4
    image1.jpg image2.jpg
     
  6. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    362
    @Lord_Chicken

    I had the same problem, which playmaker version are you using?
     
  7. Lord_Chicken

    Lord_Chicken

    Joined:
    Nov 9, 2017
    Posts:
    4
    @Kruko

    I'm using these version.

    Unity 2018.3.14F1
    Playmaker 1.9.0.p16
    EnergyBarToolkit 4.0.3p1
     
  8. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Hello,

    I am looking to use this in my project, but I have one thing I didn't see in the feature list. I am looking for a tug of war type bar in which the bar can have multiple values being displayed to show the percentage (or raw number values). For eg, a bar like this is used in the game Splatoon that shows after a Turf War match and the points gained by each team that has covered the level. See video:

    I would like to have it static though (although the starting from the edge-to-in should be added as a Grow Direction option too), like a tug of war where you can see it each teams bars going back and forth. See the pic of the idea I want.


    And take it even further by having more than 2 players/teams/colors represented in the bar. Is this possible?

    Thanks,
    jrDev
     
  9. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi!
    Please replace SpawnEnergyBarWithSpawner.cs file with the one attached. It will break the network instantiate feature, but at least it should compile without errors :)
     

    Attached Files:

  10. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi,
    It's possible to some extent. It can be done with having two bars one on another with opposite fill direction settings. Then make sure that the sum of both bar percentage values is never higher than 1.0 and the effect should be quite similar to the one on the video.

    Please let me know in case of any issues.
     
  11. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Hello,

    Hmm, that sounds like a great workaround! I will try and let you know.

    Thanks,
    jrDev
     
  12. CF-Games

    CF-Games

    Joined:
    Jun 2, 2013
    Posts:
    134
    Hello,

    I'm using Unity 2019.1.3 and there seems to be some issues with using the Sliced Bar:

    1.) I get the following warnings when I have it active on in scene:


    Unexpected call to EndFadeGroup! Make sure to call EndFadeGroup the same number of times as BeginFadeGroup.
    UnityEditor.EditorGUILayout:EndFadeGroup()
    EnergyBarToolkit.SlicedRendererUGUIInspector:SectionEffects() (at Assets/Energy Bar Toolkit/Scripts/uGUI/Editor/SlicedRendererUGUIInspector.cs:232)
    EnergyBarToolkit.SlicedRendererUGUIInspector:OnInspectorGUI() (at Assets/Energy Bar Toolkit/Scripts/uGUI/Editor/SlicedRendererUGUIInspector.cs:136)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)


    2.) When the "Value Current" is set to 0, the bar isn't empty. It still shows about 1/8 of the bar. This only happens with the Sliced Bar. I would use the Filled Bar instead, but when I resize it to something I want, the "simple_1_fg" image becomes stretched and has uneven borders.

    3.) Is there a way to use TextMeshPro text as the label instead of UGUI Text?
     
    Last edited: May 30, 2019
  13. genail

    genail

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

    1. Do you see any errors maybe? Typically this warning comes in pair with an error.
    2. I'm not 100% sure yet, but if it does the same on demos, it's by design. Unfortunately, it's difficult to get these kinds of bars to display small values nicely. I recommend hiding the beginning of the bar behind some kind of mask,
    3. I remember doing something like this. Try to drag & drop TMP label into the label field.
     
  14. CF-Games

    CF-Games

    Joined:
    Jun 2, 2013
    Posts:
    134
    Hello,

    There aren't any errors. It's just a bunch of the same warning that appears every few seconds while a Sliced Bar is active.
     
  15. CF-Games

    CF-Games

    Joined:
    Jun 2, 2013
    Posts:
    134
    Hello,

    I'm using EventSystem.IsPointerOverGameObject() so that my mouse clicks don't go through UI elements, but there are certain UI elements that I do want it to go through, such as health bars over enemies. Normally, it's possible to just uncheck the "Raycast Target" setting in the UI element, but the bars in Energy Bar Toolkit don't include this setting. Is there a way that this setting can be included, or another way to ignore the bars?
     
  16. Freznosis

    Freznosis

    Joined:
    Jul 16, 2014
    Posts:
    298
    Add a canvas group to the root of the health bar and un-check "Blocks Raycasts."
     
  17. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Is it possible that you can send me a reproduction case as a Unity project?

    It should be possible. Please let me know if the solution suggested by PSInteractive works for you.
     
  18. CF-Games

    CF-Games

    Joined:
    Jun 2, 2013
    Posts:
    134
    I went back to using a Filled Bar instead of Sliced Bar. The Sliced Bar had other issues too like it not going all the way to to 0. In your Sliced Bar demo, when the value is 0, there is still some small portion of the bar remaining, but it's flashing, which isn't something I wanted. So for bars where I need it to be sliced, I'm just going to use a Slider from the Unity UI instead.

    For it blocking raycasts, what @PSInteractive said worked. So thanks for that solution.
     
    Freznosis likes this.
  19. TheDreamEXE

    TheDreamEXE

    Joined:
    May 14, 2015
    Posts:
    60
    Hey there! Been using your product for two years now, and it's been perfect up until now for some odd reason. When I build to Windows on Unity 2018.3, I seem to be getting one extra bar in all of my menus as shown below. The strange thing is that in my editor everything appears as it should, and I do not have any editor specific code in my game at all.
    Here in the editor you can see that the Fuel count is 3, and there are 3 bars in the Repeated Renderer. The Auto Attack bars top green diagonal pips by the player's icon) is also correct and at the beginning of the game, it should be set to 1 out of 5.



    Here is the game in a standalone build. Did the same thing and you can see that all of my bars have one extra unit in them, even though my inspector is showing the correct values and the damage calculation based from the auto attack level is also correct, so it seems like it's definitely a visual issue. The strange part is that I upgraded Unity months ago and I have not touched any new builds of both Unity and the Energy Bar Toolkit. I tried importing a new version today after backing up and deleting my existing version, but that did not seem to help. Was hoping someone would have any suggestions.
     
  20. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi @TheDreamEXE ,
    Sorry for the late response.

    Can you pack and send me a piece of your project as a private message? I would like to look into it and see what can be done to get it fixed.
     
  21. Driven

    Driven

    Joined:
    May 31, 2013
    Posts:
    77
    Can you remove the legacy gui component references from the DLLs? They got removed in 2019.3 and the build crashes.
     
  22. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Could you please share me your crash log or the details how to reproduce it? I will take care of it :)
     
  23. ttborn

    ttborn

    Joined:
    Dec 24, 2013
    Posts:
    6
  24. ch1ky3n

    ch1ky3n

    Joined:
    Oct 26, 2017
    Posts:
    57
    somehow it generate error when bulding in Unity 2019 3. 01f using L2CPP (Mono is fine)

    I deleted the Energy Bar plugin completely and it works on both L2CPP and Mono

    Here's the error

    E:\ACrime\Temp\StagingArea\Data\il2cppOutput\Mad2D.cpp(34969): error C2664: 'bool Object_op_Implicit_m8B2A44B4B1406ED346D1AE6D962294FD58D0D534(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *,const RuntimeMethod *)': cannot convert argument 1 from 'GUITexture_t1679093D89FD7E758DB296145046F8BB10DB7E51 *' to 'Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *'
    E:\Crime\Temp\StagingArea\Data\il2cppOutput\Mad2D.cpp(34969): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    E:\Crime\Temp\StagingArea\Data\il2cppOutput\Mad2D.cpp(34993): error C2664: 'bool Object_op_Implicit_m8B2A44B4B1406ED346D1AE6D962294FD58D0D534(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *,const RuntimeMethod *)': cannot convert argument 1 from 'GUIText_t8C9642311EE384C7674771DDF6AB9F222CA1AE1D *' to 'Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *'
    E:\Crime\Temp\StagingArea\Data\il2cppOutput\Mad2D.cpp(34993): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    E:\Crime\Temp\StagingArea\Data\il2cppOutput\Mad2D.cpp(35195): error C2664: 'bool Object_op_Implicit_m8B2A44B4B1406ED346D1AE6D962294FD58D0D534(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *,const RuntimeMethod *)': cannot convert argument 1 from 'GUITexture_t1679093D89FD7E758DB296145046F8BB10DB7E51 *' to 'Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *'
    E:\Crime\Temp\StagingArea\Data\il2cppOutput\Mad2D.cpp(35195): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    E:\Crime\Temp\StagingArea\Data\il2cppOutput\Mad2D.cpp(35217): error C2664: 'bool Object_op_Implicit_m8B2A44B4B1406ED346D1AE6D962294FD58D0D534(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *,const RuntimeMethod *)': cannot convert argument 1 from 'GUIText_t8C9642311EE384C7674771DDF6AB9F222CA1AE1D *' to 'Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *'
    E:\Crime\Temp\StagingArea\Data\il2cppOutput\Mad2D.cpp(35217): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    E:\Crime\Temp\StagingArea\Data\il2cppOutput\Mad2D.cpp(40011): error C2664: 'bool Object_op_Implicit_m8B2A44B4B1406ED346D1AE6D962294FD58D0D534(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *,const RuntimeMethod *)': cannot convert argument 1 from 'GUITexture_t1679093D89FD7E758DB296145046F8BB10DB7E51 *' to 'Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *'
    E:\Crime\Temp\StagingArea\Data\il2cppOutput\Mad2D.cpp(40011): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    E:\Crime\Temp\StagingArea\Data\il2cppOutput\Mad2D.cpp(40040): error C2664: 'bool Object_op_Implicit_m8B2A44B4B1406ED346D1AE6D962294FD58D0D534(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *,const RuntimeMethod *)': cannot convert argument 1 from 'GUIText_t8C9642311EE384C7674771DDF6AB9F222CA1AE1D *' to 'Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *'
    E:\Crime\Temp\StagingArea\Data\il2cppOutput\Mad2D.cpp(40040): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    E:\Crime\Temp\StagingArea\Data\il2cppOutput\Mad2D.cpp(44047): error C2664: 'bool Object_op_Implicit_m8B2A44B4B1406ED346D1AE6D962294FD58D0D534(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *,const RuntimeMethod *)': cannot convert argument 1 from 'GUITexture_t1679093D89FD7E758DB296145046F8BB10DB7E51 *' to 'Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *'
    E:\Crime<message truncated>
     
    atomicjoe likes this.
  25. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    FINALLY!!
    I was going mad!
    I came here to post the same issue: energy bar toolkit is messing with IL2CPP on Unity 2019.3.0f3 and doesn't compile.
    I bet it's those pesky DLLs!
    @genail could we have the source code please?
     
  26. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Do you plan to update this asset so it can compile with IL2CPP?
    Unity 2019.3 has been officially released and this plugin is still preventing it to compile.
     
    Freznosis likes this.
  27. dFlynnSo

    dFlynnSo

    Joined:
    Aug 20, 2014
    Posts:
    17
    We need an Update for latest Unity 2019.3.0f6, this is so an awesome asset, please keep updating it
     
  28. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    I talked with the author. The update is on it's way :)
     
    dFlynnSo likes this.
  29. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    In the mean time, for those who can't wait, the problem lies on the included DLLs using deprecated methods. You have the source code in Unity's C# inside the scripts/sources folder, in some Zip files.
     
    dFlynnSo likes this.
  30. ProgOrion

    ProgOrion

    Joined:
    Nov 27, 2016
    Posts:
    13
    Hi guys,

    I have the same problem with building in Unity 2019. The error was reported 3 months ago, when can we expect the update?

    Also, what should I do with the source file? If I replace the outdated calls then I will be fine? Can you assist me with that maybe?
     
  31. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    I sent the author the corrected scripts more than 2 weeks ago, I don't know what's taking so long.
    I'll check if I can share with you only the corrected lines somehow.
     
  32. ProgOrion

    ProgOrion

    Joined:
    Nov 27, 2016
    Posts:
    13
    I would really appreciate that! Thank you!

    This is my email if you find a way:
    andras.illes@progorion.com

    But I guess you could even share them here - it would be useful for others as well for sure.
     
  33. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Ok, update guide to make the Energy Bar Toolkit compile with IL2CPP.

    First of all, I did my best to only include the specific lines in the code that needed to be fixed, so this shouldn't break any copyright.
    Also, I'll don't be supporting anyone that fixes it by himself. You're at your own. But if you follow this mods VERY PRECISELY, it must work, so, if you have any issues, just delete the Energy Bar Toolkit folder, redownload it and redo everything from scratch.

    Now to the guide:


    go to the Energy Bar Toolkit folder and delete all the DLL files:
    Assets\Energy Bar Toolkit\Scripts\Editor\Mad2D_Editor.dll
    Assets\Energy Bar Toolkit\Scripts\Editor\MadCommons_Editor.dll
    Assets\Energy Bar Toolkit\Scripts\Mad2D.dll
    Assets\Energy Bar Toolkit\Scripts\MadCommons.dll

    now, unzip this files:
    Assets\Energy Bar Toolkit\Scripts\Sources\Mad2D.zip
    Assets\Energy Bar Toolkit\Scripts\Sources\MadCommons.zip
    to this folder:
    Assets\Energy Bar Toolkit\Scripts\

    and unzip this files:
    Assets\Energy Bar Toolkit\Scripts\Sources\Mad2D-Editor.zip
    Assets\Energy Bar Toolkit\Scripts\Sources\MadCommons-Editor.zip
    to this folder:
    Assets\Energy Bar Toolkit\Scripts\Editor\

    Wait for Unity to try to compile.
    It will generate plenty of errors on
    MadiTween.cs, that's the script we have to fix.

    Be careful to NOT modify the line numbers or refactor the code when changing the script. Otherwise, the lines will not match.
    If you are using Visual Studio and it auto-refactors the code when you paste it, just press CTRL-Z one time and it will undo the refactoring and use the original lines.


    replace lines 706 to 715 with this:
    Code (CSharp):
    1.      //set tempColor and base fromColor:
    2.      if(target.GetComponent<UnityEngine.UI.Image>()){
    3.          tempColor=fromColor=target.GetComponent<UnityEngine.UI.Image>().color;  
    4.      }else if(target.GetComponent<UnityEngine.UI.Text>()){
    5.          tempColor=fromColor=target.GetComponent<UnityEngine.UI.Text>().material.color;
    6.      }else if(target.GetComponent<Renderer>()){
    7.          tempColor=fromColor=target.GetComponent<Renderer>().material.color;
    8.      }else if(target.GetComponent<Light>()){
    9.          tempColor=fromColor=target.GetComponent<Light>().color;
    10.      }
    11.  
    replace lines 744 to 753 with this:
    Code (CSharp):
    1.      //apply fromColor:
    2.      if(target.GetComponent<UnityEngine.UI.Image>()){
    3.          target.GetComponent<UnityEngine.UI.Image>().color=fromColor;
    4.      }else if(target.GetComponent<UnityEngine.UI.Text>()){
    5.          target.GetComponent<UnityEngine.UI.Text>().material.color=fromColor;
    6.      }else if(target.GetComponent<Renderer>()){
    7.          target.GetComponent<Renderer>().material.color=fromColor;
    8.      }else if(target.GetComponent<Light>()){
    9.          target.GetComponent<Light>().color=fromColor;
    10.      }
    11.  
    replace lines 3334 to 3340:
    Code (CSharp):
    1.      if(GetComponent<UnityEngine.UI.Image>()){
    2.          colors = new Color[1,3];
    3.          colors[0,0] = colors[0,1] = GetComponent<UnityEngine.UI.Image>().color;
    4.      }else if(GetComponent<UnityEngine.UI.Text>()){
    5.          colors = new Color[1,3];
    6.          colors[0,0] = colors[0,1] = GetComponent<UnityEngine.UI.Text>().material.color;
    7.  
    replace lines 4110 to 4115:
    Code (CSharp):
    1.      if(GetComponent<UnityEngine.UI.Image>()){
    2.          //guiTexture.color=colors[2];
    3.          GetComponent<UnityEngine.UI.Image>().color=colors[0,2];
    4.      }else if(GetComponent<UnityEngine.UI.Text>()){
    5.          //guiText.material.color=colors[2];
    6.          GetComponent<UnityEngine.UI.Text>().material.color=colors[0,2];
    7.  
    replace lines 4128 to 4133:
    Code (CSharp):
    1.          if(GetComponent<UnityEngine.UI.Image>()){
    2.              //guiTexture.color=colors[1];
    3.              GetComponent<UnityEngine.UI.Image>().color=colors[0,1];
    4.          }else if(GetComponent<UnityEngine.UI.Text>()){
    5.              //guiText.material.color=colors[1];
    6.              GetComponent<UnityEngine.UI.Text>().material.color=colors[0,1];
    7.  
    replace lines 4856 to 4859:
    Code (CSharp):
    1.      if(target.GetComponent<UnityEngine.UI.Image>()){
    2.          colors[0] = colors[1] = target.GetComponent<UnityEngine.UI.Image>().color;
    3.      }else if(target.GetComponent<UnityEngine.UI.Text>()){
    4.          colors[0] = colors[1] = target.GetComponent<UnityEngine.UI.Text>().material.color;
    5.  
    replace lines 4891 to 4894:
    Code (CSharp):
    1.      if(target.GetComponent<UnityEngine.UI.Image>()){
    2.          target.GetComponent<UnityEngine.UI.Image>().color=colors[3];
    3.      }else if(target.GetComponent<UnityEngine.UI.Text>()){
    4.          target.GetComponent<UnityEngine.UI.Text>().material.color=colors[3];
    5.  
    replace lines 6018 to 6022:
    Code (CSharp):
    1.  public static void CameraFadeSwap(Sprite texture){
    2.      if(cameraFade){
    3.          cameraFade.GetComponent<UnityEngine.UI.Image>().sprite=texture;
    4.      }
    5. }
    6.  
    replace line 6036:
    Code (CSharp):
    1.  public static GameObject CameraFadeAdd(Sprite texture, int depth){
    2.  
    replace lines 6043 to 6045:
    Code (CSharp):
    1.          cameraFade.AddComponent<UnityEngine.UI.Image>();
    2.          cameraFade.GetComponent<UnityEngine.UI.Image>().sprite=texture;
    3.          cameraFade.GetComponent<UnityEngine.UI.Image>().color = new Color(.5f,.5f,.5f,0);
    4.  
    replace line 6059:
    Code (CSharp):
    1.  public static GameObject CameraFadeAdd(Sprite texture){
    2.  
    replace lines 6066 to 6068:
    Code (CSharp):
    1.          cameraFade.AddComponent<UnityEngine.UI.Image>();
    2.          cameraFade.GetComponent<UnityEngine.UI.Image>().sprite=texture;
    3.          cameraFade.GetComponent<UnityEngine.UI.Image>().color = new Color(.5f,.5f,.5f,0);
    4.  
    replace lines 6086 to 6088:
    Code (CSharp):
    1.          cameraFade.AddComponent<UnityEngine.UI.Image>();
    2.          cameraFade.GetComponent<UnityEngine.UI.Image>().sprite=CameraTexture(Color.black);
    3.          cameraFade.GetComponent<UnityEngine.UI.Image>().color = new Color(.5f,.5f,.5f,0);
    4.  
    replace lines 5476 to 5484:
    Code (CSharp):
    1.  public static Sprite CameraTexture(Color color){
    2.      Texture2D texture = new Texture2D(Screen.width,Screen.height,TextureFormat.ARGB32, false);
    3.      Color[] colors = new Color[Screen.width*Screen.height];
    4.      for (int i = 0; i < colors.Length; i++) {
    5.          colors[i]=color;
    6.      }
    7.      texture.SetPixels(colors);
    8.      texture.Apply();
    9.      return(Sprite.Create(texture, new Rect(0f, 0f, 1f, 1f), Vector2.zero));      
    10. }
    11.  
    Now the script should compile without issues and you can build using IL2CPP correctly.
    If it's not the case, redo EVERYTHING from scratch. It does work as is.
    Enjoy :)
     
    Last edited: Feb 24, 2020
  34. ProgOrion

    ProgOrion

    Joined:
    Nov 27, 2016
    Posts:
    13
    Thank you very very much for your time! :) Worked as expected. Now I can move on to the other plugins not working because of my Unity update. (of course, I won't release anything, only with the official ones, but at least I can continue all the work)
     
    atomicjoe likes this.
  35. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    362
    Hello @genail

    i've got a huge overhead when using energy bar, Canvas.SendWillRenderCanvases makes 2.3kb of garbage each frame and i'm using only one canvas with only one repeated bar. When i disable it, GC alloc drops to some ~400 bytes. There's no stuff running every frame, it only gets updated when needed.
     
  36. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    That's weird, I didn't notice this in my project.
    Have you tried to reproduce this on a clean project? With only the energy bar stuff loaded?
    This would definitively show if it's the energy bars or anything else in your current project.
     
  37. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    362
    @atomicjoe

    I'll give it a go in an empty project and let you know.
     
    atomicjoe likes this.
  38. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    Keep in mind that every time something in a canvas updates, the entire canvas must be redrawn. So if you have multiple updating things in the same canvas it will be redrawing all the time.

    The most efficient approach is to have things that frequently update each in their own canvas.

    (I'm pretty sure that's how it works. If it doesn't work like that, someone please correct me.)
     
  39. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Oh... I didn't know that.
    I always wondered what's the correct way to use canvases (a single one, a canvas per group of info, etc).
    Not that the docs help in any way!
    Thanks.
     
  40. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    362
    @hopeful @atomicjoe @genail

    Ok, i tried it in 2018 and 2019, latest energy bar version, empty project, Example 5 - Repeated Bar Icon.

    GC allocation increases when i increase the repeat count along with Current Value of the Energy Bar script.

    For clarification, Value Current in Energy Bar script is set to 0. If i have repeat count of 1 in Repeated Renderer Ugui i will have GC Alloc of 400b. If i have repeat count of 16 in repeated renderer ugui i will have GC Alloc of 400b too.

    But, if i have a repeat count of 16 and Value Current 1, i get 0.7kb of trash. Value Current 10 - 2.7kb of trash. Value Current 16 - 3.9kb of trash. This is a major garbage generator.
     
  41. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Thanks for the info. I would take a look but I just received my Oculus Quest and I'm afraid I'll be very busy for a while :p
     
  42. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    362
    atomicjoe likes this.
  43. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Yeah, sorry guys. I've been going through some rough life events recently :/ It's better now, though.
    I already did the change in my repository! :) I will make sure to post the update in the next couple of days.
     
    rrahim, hopeful and atomicjoe like this.
  44. King_of_L1mbs

    King_of_L1mbs

    Joined:
    Jun 15, 2019
    Posts:
    22
    Hi @genail, I came here because I have the same Problem as @TheDreamEXE described above: Everything works fine in the editor but once I build I get one extra segment on my bars on some values. Did you ever find out what's causing this?

    EDIT: Okay, we were able to fix this for now. In your RepeatedRendererUGUI.cs on line 213 - if there is no growtype selected you check Mathf.Approximately(middleIconValue, 0) and then if not Approximatly 0 set the Segment visible. I don't know why, but in the editor for our first invisible segment this returns correctly always true and after building always false and thus makes that segment visible. Since we use only int values and there are no inbetweens we just changed it to always set invisible.
     
    Last edited: Apr 20, 2020
    Bagnol likes this.
  45. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    362
    atomicjoe likes this.
  46. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    There are some new approval policies. Being said, I need to modify more things that I originally planned to.
    Please PM me whoever needs the new package. I will send you an individual link until it's not officially published.

    All the best,
    Piotr
     
  47. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Interesting. What new policies?
     
  48. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    e.g. new asset store tools are scanning for missing references in prefabs and marking those as errors. Quite a useful tool, but I need to fix it before I can make it public.
     
    atomicjoe likes this.
  49. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    upload_2020-5-4_18-38-41.png

    It may get a little tricky which script was used in each prefab ;-)
     
  50. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    362
    Is it ok to send an e-mail since i wrote you before with invoice number and so on?