Search Unity

uGUI - Thoughts on the Most Efficient Way to Render a Gradient UI Element?

Discussion in 'UGUI & TextMesh Pro' started by daklab, Aug 31, 2014.

  1. daklab

    daklab

    Joined:
    Nov 24, 2013
    Posts:
    27
    I was curious if anyone had thoughts or suggestions on the most efficient way to implement the following:
    1. A button with a gradient as a background.
    2. A uGUI image that matches the exact size of the screen.
    I've implemented something similar to this prior to uGUI's beta release:
    http://wiki.unity3d.com/index.php?title=CameraGradientBackground

    I'm aware you could have a gradient image and stretch it for either of the above scenarios, but I don't believe that is a good approach at all. Also, the strategy as mentioned in the link above seems to be a good solution, but I was curious if there is a more efficient way and/or a more specific way when dealing with uGUI.

    Thanks in advance for any suggestions or thoughts.
     
  2. Immanuel-Scholz

    Immanuel-Scholz

    Joined:
    Jun 8, 2013
    Posts:
    221
    a shader with different vertex colors is surely more memory performant than an own image..

    (Edit: Only if you want to do a full-screen image, of course! An small sprite for a small button background will just be packed into the already existing atlas at no cost and here it is more preferable to use the same material than other elements to not have additional render calls.)
     
    Last edited: Sep 1, 2014