Author Topic: How To Set Anchors At Runtime?  (Read 2941 times)

play_edu

  • Newbie
  • *
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 21
    • View Profile
How To Set Anchors At Runtime?
« on: November 06, 2014, 12:31:46 AM »
Hi,

How To Set UI Sprite or  Widget(UI Rect) Anchors At Run time ?  Like Set Anchors (None),Set Anchors (Unified) or Set Anchors (Advanced). I can't Access This Properties.

Best Wishes,
Play_edu

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How To Set Anchors At Runtime?
« Reply #1 on: November 06, 2014, 02:16:35 AM »
UIRect.SetAnchor, or manually set each -- uiRect.leftAnchor.Set, etc.

"Unified" simply means all 4 anchors (left, right, top, bottom) use the same target.

play_edu

  • Newbie
  • *
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 21
    • View Profile
Re: How To Set Anchors At Runtime?
« Reply #2 on: November 07, 2014, 11:57:14 PM »
Thanks for ans.

I have a sprite set anchor but i want make it null at runtime , like anchor type none.


best wishes,
play_edu

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How To Set Anchors At Runtime?
« Reply #3 on: November 09, 2014, 08:53:08 PM »
So do just that. uiRect.SetAnchor(null), or individually -- uiRect.leftAnchor.target = null;