Author Topic: TweenPosition and new Anchors  (Read 9316 times)

charliehelman

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 2
  • Posts: 16
    • View Profile
Re: TweenPosition and new Anchors
« Reply #15 on: January 14, 2014, 10:26:57 PM »
UIRect.SetAnchor(null).

Cool! I was getting this error:
Quote
Assets/Scripts/UI/UIDisableAnchorAtRuntime.cs(12,24): error CS0121: The call is ambiguous between the following methods or properties: `UIRect.SetAnchor(UnityEngine.Transform)' and `UIRect.SetAnchor(UnityEngine.GameObject)'

I don't know how to feed null to a method any other way, so I just added an entirely new method to your UIRect script instead.

  1.     public void SetAnchorToNull ()
  2.         {
  3.                 leftAnchor.target = null;
  4.                 rightAnchor.target = null;
  5.                 topAnchor.target = null;
  6.                 bottomAnchor.target = null;
  7.                
  8.                 ResetAnchors();
  9.                 UpdateAnchors();
  10.         }

Works perfectly so far!

Lotti

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 47
    • View Profile
Re: TweenPosition and new Anchors
« Reply #16 on: January 21, 2014, 04:03:04 AM »
I haven't noticed your answer until now! :)

I'll try using a gameobject container between panel and widgets. Anyway i find that disabling anchors on all the children after they are positioned (eg: first update loop) let me move the panel without problem.

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: TweenPosition and new Anchors
« Reply #17 on: January 21, 2014, 04:51:25 AM »
It seems in the release notes, that the latest version allows you to use TweenPosition with the new anchor system (but didn't try it yet).

Lotti

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 47
    • View Profile
Re: TweenPosition and new Anchors
« Reply #18 on: January 21, 2014, 04:57:10 AM »
i tried placing a gameobject container between panel and widgets... nothing changed (with latest ngui version).

So i'll stay with the old configuration, disabling anchors after widgets are placed (actually we use anchor just for interface and for 4:3 <-> 16:9/10 support).