Author Topic: New anchoring system - very frustrating. Please explain it better.  (Read 5319 times)

vexe

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 153
    • View Profile
The new anchoring system overcomes the weaknesses in the old system and it does a better job than the previous Anchor+Stretch.

But it's really annoying in terms of practical usage - I mean, I just wanna anchor something to the top left corner of a background, it's just so tedious... What should I do with those 4 values? Previously, I just set the anchor to topleft and that's it. Now we have 4 values... what for? (I've seen the anchor demo video - but it just didn't cut it... )

Please explain what those four values mean - (what does it mean for the right of my object, to be in the right/center/left, etc of the target?)

I just have a very simple Colored slider that I want to anchor to the topleft of a background yet no matter how much I mess with the values, I can't seem to get the right ones....

Please explain.

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: New anchoring system - very frustrating. Please explain it better.
« Reply #1 on: December 14, 2013, 12:42:50 PM »
http://www.tasharen.com/forum/index.php?topic=7013.0

To anchor something to top left, drag it there, then turn on Unified anchoring (and if it's not the parent you're anchoring to -- drag in the target's transform).

By default it will already anchor to top left. If it doesn't, just change the Left & Right to use "Target's Left", and Top & Bottom to use "Target's Top".

Not sure what the confusion is.

hellobard

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: New anchoring system - very frustrating. Please explain it better.
« Reply #2 on: December 14, 2013, 05:42:51 PM »
I've got to agree with vexe here, the previous anchor system was intuitive and easy to understand.
the new system is very hard to get working properly. how about making a specific mode for just the old way the anchors worked? it would make it easier for newcomers and faster for everyone else.

kruncher

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 78
    • View Profile
Re: New anchoring system - very frustrating. Please explain it better.
« Reply #3 on: December 14, 2013, 07:18:33 PM »
I think the new anchor system is far easier; the prior was really tricky to setup!!

The nice thing with the new approach... if it automatically anchors to the wrong thing, it will automatically recalculate the offset values when you change the anchor target. That is such a wonderful feature which saves a lot of time and effort.

I think it would be nice if the UI was perhaps a little more visual... but I must admit, I am rather fond of this new system :D

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: New anchoring system - very frustrating. Please explain it better.
« Reply #4 on: December 14, 2013, 07:20:23 PM »
Can't please everyone. Vast majority like the new anchor system, but if you like the old one, you're still welcome to use UIAnchor & UIStretch combo. I didn't remove them.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: New anchoring system - very frustrating. Please explain it better.
« Reply #5 on: December 14, 2013, 08:13:52 PM »
UIAnchor.cs is still in there, use that if you want the old style. And bring on suggestions for making the new system better. :)

vexe

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 153
    • View Profile
Re: New anchoring system - very frustrating. Please explain it better.
« Reply #6 on: December 15, 2013, 02:34:06 AM »
Speaking of suggestions to make things better: I suggest to use a combination of both the ease of use of the old one, and the efficiency and power of the new one.

As a consumer here's how I'd love to see it happen:
I click on Anchor type | from that I get | TopLeft, TopRight, Center, Bottom, etc (Enum values) | click on one, and the widget would automatically anchor to that point (of course there would be a target field that gets automatically filled with the parent object like the new system does it) - after I anchor, there are 2 offset values I could change (much like the relative offset in the old one) - and I can also move the anchored widgets even if it's anchored much like in the new system.

I think that is much simpler as it avoids dealing with those cumbersome 4 values.

That is my humble opinion for "making the new system better" :)

arkon3

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 71
    • View Profile
Re: New anchoring system - very frustrating. Please explain it better.
« Reply #7 on: December 15, 2013, 02:43:53 AM »
Well,I hate the new system. I have a sprite that I used to just set it's anchor top left etc. Now it's got 4 values i seem to have to manually set, and god knows what to. The new way is very frustrating and for the life of me I can't now figure out how to do it the old way as a sprite doesn't have an old way box to set it with.

arkon3

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 71
    • View Profile
Re: New anchoring system - very frustrating. Please explain it better.
« Reply #8 on: December 15, 2013, 02:51:07 AM »
http://www.tasharen.com/forum/index.php?topic=7013.0

To anchor something to top left, drag it there, then turn on Unified anchoring (and if it's not the parent you're anchoring to -- drag in the target's transform).

By default it will already anchor to top left. If it doesn't, just change the Left & Right to use "Target's Left", and Top & Bottom to use "Target's Top".

Not sure what the confusion is.

The confusion is: I have a sprite 180w by 80 high. I set the unified parameters to how you say and now the sprite dimensions change to 2 x 80! WTF? The Anchors box says Left +229 Right +43 bottom -592 top -512

It's just horrible and I've no idea what it's doing, I have a 1024 x 768 screen anchored top left meaning the anchor game object has a transform of -512 384. I want a 180 x 80 sprite to be on the screen with it's top left pixel at coords 319, 552 This new way is just well terrible!

I get the coordinates of where to put my sprites from the master psd file, but now there seems no way to just enter these coords into the sprites transform and have it appear in the correct place.
« Last Edit: December 15, 2013, 03:05:03 AM by arkon3 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: New anchoring system - very frustrating. Please explain it better.
« Reply #9 on: December 15, 2013, 08:00:51 AM »
Nothing should change the dimensions of your sprite by anchoring. Make sure you have the latest version.

The only useful thing to know about the new system is that you can anchor to Panels, Cameras, Widgets, and Transforms. How it behaves depends on what component is found on the "Target".

Cameras, panels and widgets all have width and height, so you can anchor to their sides, corners and center.

Transforms (game objects with nothing on them) don't have any width and height, so when you anchor to a raw game object, there is no "left", "right", etc to choose from. You only get 4 offset values. So if the transform happens to be positioned at XY on the screen, the 4 values are simply added to that position to produce the final widget's coordinates.

When you want to anchor something to the top left corner of the screen, you should either specify the Target to be the Panel (which is by default on UIRoot now), or the Camera (your UI camera). Otherwise you're anchoring relative to a completely different object.

Lastly, there is never any need to set the 4 values manually. Simply resize your widget in the scene view like you normally would if it wasn't anchored.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile