2D Toolkit Forum

2D Toolkit => Support => Topic started by: BrysonGR on June 25, 2013, 08:31:28 pm

Title: Scaling UI with anchors
Post by: BrysonGR on June 25, 2013, 08:31:28 pm
Hi,

I'm trying to set up a 2D Toolkit UI which uses anchors. From what I can gather from the docs, it looks like I need to use a tk2dCamera, which also means that 1 unit = 1 pixel. This means that all the controls (TextInput, BasicButton, etc.) need to be scaled up, right? What's the recommended way to do this? I just created a parent "UI" object with a scale of (400, 400, 400) and dropped controls into it.

I'm thinking this may not be the right solution because the TextInput control doesn't quite work right. The field length needs to be greatly increased to match the control's scale, but the field length gizmo doesn't scale right (it's way too long). Is this just a bug? Or is this a sign that I'm not approaching this the right way?

Basically: what is the proper way to build a scalable UI with anchors, based on the UI demo control prefabs?
Title: Re: Scaling UI with anchors
Post by: unikronsoftware on June 25, 2013, 09:44:02 pm
Contrary to popular belief you don't NEED to use the tk2dCamera for anchors. If thats all you need it for, I'll be happy to post the new anchor code tomorrow, which will work independently to the camera type.
Title: Re: Scaling UI with anchors
Post by: BrysonGR on June 25, 2013, 10:12:31 pm
Yeah, that'd be great. I'm looking into using 2D Toolkit for all my UI instead of NGUI, which I've used up 'til now. I don't need everything to be pixel-perfect, but definitely need anchors. :D
Title: Re: Scaling UI with anchors
Post by: unikronsoftware on June 25, 2013, 10:40:24 pm
I think there is a real misconception that you NEED the tk2dCamera to be pixel perfect - its meant to solve a completely different set of problems really. You can have pixel perfect, anchors and what not on any camera, any resolution. I'll get this thing done tomorrow and post a preview on this forum.
Title: Re: Scaling UI with anchors
Post by: unikronsoftware on June 26, 2013, 10:39:16 pm
You can find the new tk2dCameraAnchor system in the private support forum here:
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,1987.0.html