Problem about scaling my UI

Hello,
I already wrote a post in another thread, but I did not get any answer.
So, I have the following problem: (The Pivot is located at the center of the Interface-Element)
The Pivot should have an offset of ~ 25% to the left border , so it should
take 50% of the screen’s width. I also want the pivot to have an offset of 12.5% to the bottom so it would take 25% of the screens height. How can I implement that? I mean, the new GUI works with fix values relative to the anchors…

When you have elements that take up a percentage of the parent like that (stretching behavior) it’s easier to think of where the edges should be than where the pivot should be.

If I understand correctly you want the rect in the lower left corner of the parent, and for it to take up 50% of the width and 25% of the height?

If so, set anchorMin to (0, 0) and anchorMax to (0.5, 0.25)

Thanks for your answear! Now it works likr it should. Btw, How can I change a Buttons image?
Button.GetComponent().?

Try having a look in the scripting reference for the Image component.

Of course, thats what I already did, but I really don’t find any infos about the New GUI system in the scripting reference. There is no Entry for the UI namespace and the graphics category Does not include any information about the New GUI system’s components. The Image Script has a Source-Image Property in the Editor, but I cant access it via code.

[quote=“Fevenius, post:5, topic: 548535, username:Fevenius”]
Of course, thats what I already did, but I really don’t find any infos about the New GUI system in the scripting reference. There is no Entry for the UI namespace and the graphics category Does not include any information about the New GUI system’s components. The Image Script has a Source-Image Property in the Editor, but I cant access it via code.
[/quote]

http://forum.unity3d.com/threads/ui-documentation.263523/

2 Likes