Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Siddharth3322 on January 21, 2014, 09:56:13 PM
-
Currently I am using NGUI for menu creation. In that I want to place my back button in top left corner of the screen. I have problem regarding this. Currently I am focusing on 1920x1080 resolution but when I switch to another resolution say 480x320 then my back button goes out of the screen. So I want some tips in this. Please help me in this because I already spent half day to come out of this.
-
It's easy with the new anchors system. Set the back button's anchor type to Advanced with the Left and Top targets set to the panel the button belongs to. Leave Right and Bottom blank. I would recommend watching the video on the UIRect documentation page (http://www.tasharen.com/forum/index.php?topic=7013.0).
-
It's easy with the new anchors system. Set the back button's anchor type to Advanced with the Left and Top targets set to the panel the button belongs to. Leave Right and Bottom blank. I would recommend watching the video on the UIRect documentation page (http://www.tasharen.com/forum/index.php?topic=7013.0).
Thanks for your reply. First I will read it carefully and then reply you as soon as possible if I have any difficulty.
-
I have few questions regarding this.
At present I have set my back button->background anchor as suggested in the image.
Following is my button widget structure
Button
->Background
->Label
Basically structure created is Button widget and in which Background sprite is created. Background contains a sprite and Button contains a box collider. So at present situation was that Background gets new position but collider stay at its old position so no click detection become possible. So how to come out of this?
My another problem is that button already created larger than normal image size so what was the problem in that?
If you want any more information then I will provide it any time.
-
Let me guess... Button is just a game object? You need to make it a widget, and anchor this widget not its child.
Or just use the Background sprite as the button:
Button (UISprite, UIButton)
- Label
-
@ArenMook, Thanks to reply. It is pleasure for me to get a chance to discuss with you.
At present I can able to place button at corner position and it stick at that position regardless of any resolution. But button remains in same size regardless of resolution. So how to handle this situation? Following image demonstrate my problem correctly.
-
Instead of using all absolute anchor values, use relative. Only relative values scale with the target's dimensions.
-
My back button inspector panel look like following so what value I have to modify?
-
You see the drop downs "Target's Left", "Target's Bottom"? Change them to "Custom". You can then modify relative values. Check the documentation page for UIRect.
-
So now I have done following thing to place button at bottom left corner and as per my consideration it works perfect.
If you have any other best solution then please suggest me.