GUItexture Layout

okay im retarded - ive been fiddling around with gui texture layout for 2 hours and I can’t seem to get it to work.

I have 4 textures, one for each corner,
I have managed to position them as 1,0 1,1 0,1 0,0 and they seem to be in the right corners - but they are off screen. pixelInset is set to
Xmin:-15
Ymin:-15
Xmax:15
Ymax:15
and all border’s are 0

further more i would like to turn a cameras guilayer off (so it stops rendering all gui objects attached to it)
I have tried GUILayer.enabled = false; but its obviously wrong

Are the gui textures completely offscreen or only partially offscreen? I’m assuming that they are partially offscreen (the midpoint of each texture is at each corner) and as such you’ll need to modify the pixel inset values for each corner separately:

left side: xmin=0, xmax=30
right side: xmin=-30, xmax=0

top: ymin=-30, ymax=0
bottom: ymin=0, ymax=30

so…

top-left: xmin=0, xmax=30, ymin=-30, ymax=0
bottom-right: xmin=-30, xmax=0, ymin=0, ymax=30

Using those values should place your gui textures in the corners properly. As far as disabling the GUI Layer by scripting goes I too am a bit puzzled… (sorry, still a bit of a noob myself :stuck_out_tongue: )

Try “GetComponent(GUILayer).enabled = false;” Technically I think that’s how all components are referenced, but some stuff you can refer to directly. “GetComponent(Camera).enabled = false;” can be written as “camera.enabled = false;” for example. So when it doubt, GetComponent.

–Eric

Thank you Tom and Eric!

Both worked perfectly!

Oh, good. :slight_smile: I edited my post to explain a little more.

–Eric

yah thats what confused me - i was doing that and it was working for somethings

Hrmm is it possible to assign GUITexture’s to different GUIlayers

so some textures and referenced to one camera and the others to another camera.

I have a camera for a 2d background
A camera for the 3d world
and a camera for the HUD which turns on and off frequently

Yes. You can assign different layers to the GUITextures and layer masks to the cameras.

ahhh sweet got it working - thank-you very much for your support while i get used to unity

I am having some trouble tiling a GUITexture in Unity

I have a 5x5 pixel texture I want to tile,

I have set Transtion
0, 1, 0
0, 0, 0
0, 0, 0

Pixel Inset:
Xmin: -5
Ymin: -5
Xmax: 5
Ymax: 5

Left Border: 800
Right Border: 0
Top Border: 600
Bottom Border: 0

And this is the result (How it should tile is in the top left corner):
Why is it making little waves as opposed to straight lines?

31869--1156--$unityscreenx400_603.png

Sorry but I don’t have any answers, just questions…

  • The “Transtion” data you showed, are those really the transform position/rotation/scale values?

  • Am I’m missing something? How are you getting it to “tile” at all? GUITextures don’t tile as far as I’m aware… (educate me if necessary, thanks :slight_smile: )

  • It’s a 5x5 texture, yet your pixel inset seems set for a 10x10 texture?

  • The border values are only used when you scale the texture, right? If so then they should be ignored as it seems your scale is set to 0,0,0.

Hopefully I’m being helpful… :stuck_out_tongue:

Whoops sorry yes Transform :stuck_out_tongue: :sweat_smile:

If you create a default texture (UnityWatermark-small) and set its top and left border to 800 and 600 and x position 0 and y position 1 - you will see it tile, and it seems to tile normally, it seems the problem occurs where theres transparency

The texture has to be Repeat instead of Clamp

Yes thats correct, in my tests I have also created a 6x6 texture (power of two) and have made pixel inset -3, -3, 3, 3
and i still get the same trouble

I think the border values prevent the texture from scaling,
in the case, because its not scaling it draws a larger canvas and forces the texture to fill it.

Ive been fiddling around with this all weekend - changing the pixel inset seems to produce different effects but the seem between tiles is abit wonky no matter what I do

6x6 is not a power of two. I just tried 8x8 (which is a power of two) and was able to successfully tile a GUITexture using this method. 6x6 doesn’t work right as you note. Interesting concept…not sure if it’s a bug or a feature though. :slight_smile:

–Eric

oops! silly me! okay well i did 8x8 and i get tiling to mostly work!

BUT

Look closely! there is a one pixel shift after x amount of pixels look at screenshot(ignore top left corner)

32004--1166--$unity001_207.png

What settings are you using for the pixel insets/borders? I’m not getting any pixel shifts at all here.

–Eric

Transform
0,1,0
0,0,0
0,0,1

Pixel Inset
-4
-4
4
4

Borders
Left 800
Right 0
Top 600
Bottom 0

Edit: I created a new guitexture and did the exact same and it works fine now thanks everyone :slight_smile:

is it a bug it only tiles for power of 2 textures?