Hi,
I am creating a script that will generate and display GUI overlays on-demand using a given piece of text as the content.
The aim of the game here is to produce a method which can just take a given text and draw a box on the screen containing the text with the appropriate style. All of the boxes drawn must have a border consisting of images for the corners and sides. Since the text is highly variable and generated at run time, the box borders must be scalable.
There is a function, makeOverlay(string txt), that causes a GUI Box to be drawn on screen (with txt in), surrounded by 8 “border” Boxes. The border boxes each have an image assigned for the background:
((GUIStyle)tl).normal.background = (Texture2D)Resources.Load(“GUI/Dialog/Back/Back Top”);
tl.normal.background.wrapMode = TextureWrapMode.Repeat;
GUILayout.Box(“”,tl);
The problem I am having is that I can’t get the background images to repeat in the x and y directions for the boxes that appear on the sides (centre-top,middle-left,…). I was aiming to implement this like you would use CSS to create a similar effect with
background-repeat:repeat-x;
Any help making this work or any suggestions for a more sensible approach to making an overlay generator would be very much appreciated.
Cheers,
Tom
P.S. Sorry if this is a repeat post but I am having trouble finding it anywhere…