Author Topic: Anchors not working  (Read 3196 times)

artician

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Anchors not working
« on: May 22, 2014, 04:42:08 PM »
Hi,

I am running latest version, but over the last year, starting with NGUI 3.x, I've upgraded several times, so maybe it's a legacy issue?

My anchoring system does not work, I turned on Unified Anchoring for a sprite but it does not behave anything like what your tutorial videos show.  The main issue is that when I resize the viewport window in the editor, the Widgets do *not* move according to their anchor settings.  They behave as normal (moving off screen).
I have a basic setup in the form of a UIPanel, with a nested UIPanel beneath it.  In the child UIPanel, I have one sprite, which is the widget using anchoring. 

Any idea?

Thank you!

artician

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: Anchors not working
« Reply #1 on: May 23, 2014, 05:03:51 PM »
Anchors are still not working in my scene after creating a new UI with the latest versions of NGUI.  Please help.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchors not working
« Reply #2 on: May 23, 2014, 05:33:06 PM »
Unity 3 doesn't update the scene content when resizing the game view. You need to hit Play for it to be updating it. I added the update code to Unity myself when I was working at Unity Tech -- back in version 4.1 or so.

artician

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: Anchors not working
« Reply #3 on: May 23, 2014, 05:35:23 PM »
So I should be able to set my anchors, and at runtime set my resolution, and have confidence that it will adjust correctly?  I don't have a lot of devices to test with so it's difficult for me to verify it on my end.  If I'm wrong about that please let me know.  Otherwise, thanks very much for the clarification.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchors not working
« Reply #4 on: May 23, 2014, 06:33:05 PM »
Just hit CTRL+S twice to force Unity 3.5 to refresh.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Anchors not working
« Reply #5 on: May 24, 2014, 07:54:44 AM »
If you have the game window free floating, you can also drag it around a little after resizing, then it will also force a refresh.

artician

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: Anchors not working
« Reply #6 on: May 24, 2014, 08:53:46 AM »
Thank you for the suggestions, that works wonderfully.