Image size vs Label size problems, Image gets scaled down

I try to follow the nested groups part of the gui tutorial. Interesting part for me was the clipping behaviour Unity - Manual: IMGUI Layout Modes

What i try to achieve is to have a compass. So i tinkered around with a second GUI group to mask both ends of my inlay part, and move the inlay instead the maskpart. I got it working somehow.

The problems comes when i wanted to fit my compass inlay to the compass case. The moveable part, the inlay of the compass graphics is 270 pixels long. The visible area is in the compass case 90x48. The code is setup to display 90 pixels of my inlay too. But the result is not fitting. Unity scales my graphics down. The visible area in the compass case becomes 72 pixels by that. And so the inlay part to display is too big. Doesn`t fit anyways because also the inlay gets scaled down.

I could of course take all this into account and shorten the inlay part to display also just 72. But then my whole calculations gets even more complicated.

What happens here? Why does Unity scale down my graphics in the GUI? And how can i fix it?

Attached the scene with code and graphics. Extract the compass file, load the Kompass scene, run it, and you will see what i mean.

Have it. Was a combination of own fault because of wrong calculation (the gap is 80 pixels, not 90),and the fact that Unity seems to dislike non square textures. At least in this case. Okay. Now i know :slight_smile:

Fix was to use a square texturesize in the code for the foreground texture. Even when the texture is not square. And now the result is somehow fitting.