- Home /
Question is not actual anymore
Is it possible to stretch a part of texture in GUI ?
Unity GUIStyle has a good thing called Border, but it can make a non stretching a part of texture only at EDGES of texture.
Is it possible to make vice-versa - to make some area in CENTER of texture non-scalable, and stretch an edges of texture?
The goal is to make a semitransparent texture with a "hole". This texture should hide other GUI elements and make visible just a little area below the hole. I use GUI Label with custom GUIStyle to show this texture. Because the hole will appear in any part of screen (and other part of screen must be hidden by texture), I have to make the Label with the size twice larger than screen (to cover all screen even when the hole is at the any edge of the screen).
And now I have a dilemma: I have to make texture size unreasonable large (about 4000x4000 where critical part - is a "hole" about 100x100 with soft edges, and other is just solid grey color) to have fine picture of a hole.
But maybe there is a way to make texture smaller? For example - to make 128x128 texture and use 100x100 pixels for "hole" and 14 pixels for each border (with solid color). But the question is HOW to display a hole pixel-to-pixel and a border - stretched to whole screen?
P.S. I know that I can make a plane or a mesh and solve the stretching problem with UV-cords, but I have to hide a GUI elements with this texture.
tried to make 2 textures - one small but stretched to make a large solid fill (with square "hole" that should be filled by second fine texture), and second texture to make fine "hall" with soft edges (not stretched, pixel-to-pixel). When the textures are opaque - it looks O$$anonymous$$ (second hides ugly edges of hole in first texture, and they both are just 128x128, as I wish), but when they are 50% transparent - the edges of first textures becomes visible, and it looks ugly :(
Follow this Question
Related Questions
Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer
getgui joystick's guiTexture's furthest borderfrom its default position 0 Answers
Creating GUITexture with a reference 1 Answer
Activate GuiTexture When Clicking on BoxCollider c# 1 Answer
WorldToScreenPoint returns the same value when facing the opposite direction. 0 Answers