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
    That's correct!
     
  2. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    319
    Still making garbage like there's no tomorrow :D i'll check out if renderers other than repeated bar are making overhead.
     
    atomicjoe likes this.
  3. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Posting an update:

    There are more incompatibilities than I first expected :/ Currently, I'm trying to bring fonts subsystem to work. It's not a must-have, but I can't remove it either.

    I will keep you posted!
    - Piotr
     
    julianr and Oshigawa like this.
  4. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    319
    Seems complicated, bummer. Sad to bug you about that, but 8 megs of trash per minute is a lot, i can't imagine how it is if someone has more then 10 units in the renderer...
     
  5. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Which renderer are you using? I will try to work around it somehow.
     
    Oshigawa likes this.
  6. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    319
    Repeated Renderer UGUI.
     
  7. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Thanks!
     
    Oshigawa likes this.
  8. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    319
    No problem.
     
  9. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    Hey @Oshigawa ,
    How did you measure GC allocation? Did you run the scene directly in the editor or did you connect the profiler to the build app?

    I tried both, and while I'm seeing GC allocations in the editor, there are none after doing the build. The reason is that the editor is doing some additional stuff that I don't have control over it.

    Please let me know how it is in your case. If you're still seeing any allocations, is there a chance that you could send me a demo scene?

    All the best,
    Piotr
     
    Oshigawa likes this.
  10. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    319
    In the editor, i'll try testing in the build and let you know.
     
    genail likes this.
  11. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    319
    Hi Piotr,

    there's no allocations in the build. Sorry for the harassment, i should have checked it before, i wasn't profiling my builds until now. Something new learned, eh.
     
    atomicjoe likes this.
  12. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,044
    No worries. I'm glad it works!
    Sorry for not noticing that earlier. Not working with Unity daily has its consequences -_-

    Cheers!
    Piotr
     
  13. XCO

    XCO

    Joined:
    Nov 17, 2012
    Posts:
    366
    Hello I got an error can you please help me understand what to do ?

    UNITY 201.4 LTS

    Assets/Energy Bar Toolkit/Scripts/uGUI/EnergyBarSpawnerUGUI.cs(84,33): error CS1525: Unexpected symbol `networkGroup', expecting `.
     
  14. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    74
    After upgrading to Unity 2020.1.0f1 I'm getting the following exception whenever an energybar is active:

    Code (CSharp):
    1. MissingComponentException: There is no 'CanvasRenderer' attached to the "generated_bar" game object, but a script is trying to access it.
    2. You probably need to add a CanvasRenderer to the game object "generated_bar". Or your script needs to check if the component is attached before using it.
    3. UnityEngine.UI.GraphicRaycaster.Raycast (UnityEngine.Canvas canvas, UnityEngine.Camera eventCamera, UnityEngine.Vector2 pointerPosition, System.Collections.Generic.IList`1[T] foundGraphics, System.Collections.Generic.List`1[T] results) (at C:/Program Files/Unity/Hub/Editor/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/GraphicRaycaster.cs:321)
    4. UnityEngine.UI.GraphicRaycaster.Raycast (UnityEngine.EventSystems.PointerEventData eventData, System.Collections.Generic.List`1[T] resultAppendList) (at C:/Program Files/Unity/Hub/Editor/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/GraphicRaycaster.cs:225)
    5. UnityEngine.EventSystems.EventSystem.RaycastAll (UnityEngine.EventSystems.PointerEventData eventData, System.Collections.Generic.List`1[T] raycastResults) (at C:/Program Files/Unity/Hub/Editor/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:255)
    6. UnityEngine.EventSystems.PointerInputModule.GetMousePointerEventData (System.Int32 id) (at C:/Program Files/Unity/Hub/Editor/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/InputModules/PointerInputModule.cs:277)
    7. UnityEngine.EventSystems.StandaloneInputModule.ProcessMouseEvent (System.Int32 id) (at C:/Program Files/Unity/Hub/Editor/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/InputModules/StandaloneInputModule.cs:541)
    8. UnityEngine.EventSystems.StandaloneInputModule.ProcessMouseEvent () (at C:/Program Files/Unity/Hub/Editor/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/InputModules/StandaloneInputModule.cs:527)
    9. UnityEngine.EventSystems.StandaloneInputModule.Process () (at C:/Program Files/Unity/Hub/Editor/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/InputModules/StandaloneInputModule.cs:282)
    10. UnityEngine.EventSystems.EventSystem.Update () (at C:/Program Files/Unity/Hub/Editor/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:376)
    Is this version of Unity not supported?
     
  15. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    74
    I managed to fix the issue by adding a CanvasRenderer component to the generated bars in EnergyBarUGUIBase's CreateChild function.
     
    therewillbebrad and ExtReMe1983 like this.
  16. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    146
    Can confirm this is what worked for me in 2020.1

    Code (CSharp):
    1. Here is the updated function CreateChild:
    2.  
    3. protected T CreateChild<T>(string childName, Transform parent) where T : Component {
    4.         var child = CreateChild<T>(parent, "generated_" + childName);
    5.            
    6.         if (!child.gameObject.GetComponent<CanvasRenderer>())
    7.             child.gameObject.AddComponent<CanvasRenderer>();
    8.  
    9.         createdChildren.Add(child.gameObject);
    10.         SetAsLastGenerated(child.transform);
    11.         ApplyDebugMode(child.gameObject, debugMode);
    12.         return child;
    13.     }
    That's the code snippet from snair in the reviews. Manually adding a canvasrenderer will also work.
     
  17. TillmaniaLtd

    TillmaniaLtd

    Joined:
    Jan 29, 2013
    Posts:
    45
    Hey,

    Having compile issues after upgrading to Unity 2019.4:

    /Classes/Native/Mad2D.cpp:35233:15: No matching function for call to 'Object_op_Implicit_m8B2A44B4B1406ED346D1AE6D962294FD58D0D534'

    1. Candidate function not viable: no known conversion from 'GUITexture_t1679093D89FD7E758DB296145046F8BB10DB7E51 *' to 'Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *' for 1st argument

     
unityunity