- Home /
Extra texture over top of a Guilayout.button?
Hello all, I have a guilayout.button. It has a skin to give it a texture I made. I would like to superimpose another texture (that has some alpha to it) so that I can make it look like the button has a countdown style progressbar. As the timer ticks down (or up.. whatever) the superimposed texture will change in width. I already have tested the rest of the code on the button itself and the button size shrinks with time until the time is up then pops back to its full size.
I'd really like to put a texture on top (or underneath) the button.
Any ideas how to do this? (I'm using GUILayout, so I don't really have access to its x/y coords do I?)
Answer by Craig Farrell · Oct 15, 2010 at 12:07 AM
I solved this (not sure if it was the right way...)
I used GUI.DrawTexture and placed it within my GUILayout.Window and placed it directly under my button, then scaled it with a timer. It worked like a charm.
Answer by PeterDC · Oct 14, 2010 at 06:44 AM
Look at the GUI layout modes in Unity's documentation; it has an example for using groups to do this sort of thing. Also, here's links to GUI.BeginGroup and GUI.EndGroup
I can add a texture. I need to add a second texture. Or overlay a texture in the exact position of the button.