Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Irregular shape UI Meter

Discussion in 'UGUI & TextMesh Pro' started by AriathTheSage, Aug 25, 2014.

  1. AriathTheSage

    AriathTheSage

    Joined:
    Aug 25, 2014
    Posts:
    13
    Hi, first of all, thanks a lot for releasing this beta, i was anxious to play with the new UI system :) .

    I'm trying to create a multi-purpose meter to show health level, shield level, whatever.

    But i have a problem, i want to be able to create irregular shaped meters, and after searching a while i reached this: http://forum.unity3d.com/threads/health-bar-ui.42813/

    So, i know i need a texture using alpha cutoff, but, i have searched among the uGUI shaders, and none seems to support alpha cutoff.

    I'm testing using an overlay GUI.

    See ya!
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Let me stop you right there. Before 4.6, you needed an alpha cutoff. If your life meter is circular, for example, you now have various fill options under "Image Type".

    If you need something more complicated, you might still need an image cutoff, but those fill options fit most uses.
     
    rakkarage likes this.
  3. AriathTheSage

    AriathTheSage

    Joined:
    Aug 25, 2014
    Posts:
    13
    Mmm... i didn't thought of the fill options for circular meters, you are right :S .
    But, for a multi-purpose meter prefab, i think it is better to use alpha cutoff always, as it is a general solution, so you can use it to make circular, straight, or even cross shaped meters.

    What i'm thinking now is, can i use any shader to render uGUI elements?
    For example, the Transparent/Cutout/VertexLit has alpha cutoff.

    But, if i use it, the meter only renders in Scene window, not in game.
    So, i suppose, the Canvas Renderer can't render this material, right?

    See ya!
     
  4. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    You can replace the material on GUI objects. I don't recall if there are special requirements for thos ematerials, but I don't think there are.