Author Topic: resolution - functionality questions  (Read 3586 times)

wouter

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 39
    • View Profile
resolution - functionality questions
« on: November 22, 2012, 07:12:34 PM »
I really want to buy this plugin, but I need to know a couple of things before I can do so;

-on android and iphone/ipad the screen width and height change quite dramatically.
I know I can anchor things to parts of my screen and that solves some problems.

However that still means I have to design for the minimum width out of a range of target devices, since the width won't scale or anything, and thus buttons and gui gets cut off on some devices other wise? especially when also supporting portrait this becomes a problem.
Is there a way around this?

using the gui system of unity itself these buttons would auto scale to a percentage of the screen size, and things would always fit.
This is the biggest problem, if I can work around this somehow I will buy it.

-secondly, I created a search script, which automatically searches for objects and return found results in buttons.
Is there someway to use your ngui and send a request to my script and then send back the buttons to ngui again?

In other words; how can add my own functionality(scripts) to buttons and have them interact both ways..

I really hope these issues can be resolved becaus Ngui really looks awsome.




ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: resolution - functionality questions
« Reply #1 on: November 22, 2012, 10:58:39 PM »
1. Uncheck the "automatic" option on UIRoot, and your UI will always be the same size proportional to the height of your screen, regardless of whether you're on 320x240 or 1920x1080.

2. Create a script attached to your button that has a function: "void OnClick() {}". Do whatever you want inside. If you have a manager that creates a bunch of buttons programmatically, you can instead do UIEventListener.Get(buttonGameObject).onClick += YourEventHandler;

wouter

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 39
    • View Profile
Re: resolution - functionality questions
« Reply #2 on: November 23, 2012, 06:32:10 AM »
1. Uncheck the "automatic" option on UIRoot, and your UI will always be the same size proportional to the height of your screen, regardless of whether you're on 320x240 or 1920x1080.

2. Create a script attached to your button that has a function: "void OnClick() {}". Do whatever you want inside. If you have a manager that creates a bunch of buttons programmatically, you can instead do UIEventListener.Get(buttonGameObject).onClick += YourEventHandler;


1. Only the height will scale the gui, changing the width of the screen doesnt do anything. Meaning it gets cut off if the screen get smaller.

So that brings me back to my original question....

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: resolution - functionality questions
« Reply #3 on: November 24, 2012, 01:49:30 AM »
You need to use anchors and make your UI modular -- some widgets attached to corners, some centered, some attached to sides. That's the only way to account for all the different aspect ratios properly.

wouter

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 39
    • View Profile
Re: resolution - functionality questions
« Reply #4 on: November 24, 2012, 07:30:48 AM »
You need to use anchors and make your UI modular -- some widgets attached to corners, some centered, some attached to sides. That's the only way to account for all the different aspect ratios properly.

first off thanks a lot for you quick replies!

secondly than it is as i feared...
I mean I know you can attach the widgets to corners and that works fine, but if the screen width gets smaller and the buttons width stays the same, you need to accound for the smallest screen width right.

another example, say I want a pop up in the centre of my screen. I anchor it to the centre. say this works fine in landscape view, now i turn the mobile for portrait and the sides gets cut off.. There is nothing i can do about that?

I am sorry to bother you with all these question..  :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: resolution - functionality questions
« Reply #5 on: November 24, 2012, 08:29:16 AM »
You can adjust the UIRoot's scale yourself by leaving it on 'manual' and writing a small script. If you want it to be based on width instead of height, or the largest of the two, then you can do just that.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: resolution - functionality questions
« Reply #6 on: November 24, 2012, 12:57:15 PM »
You have to handle the resolution yourself then.

You can see the actual Screen.height and Screen.width and if you design your UI to handle different aspects, you can switch between designs based on that and calculate and set the manualheight so that it keeps the sizes you want.