0

I am trying to figure out how to, via c#, change the topAnchor point in my UIPanel.

Here is how I am trying to go about it:

// The GameObject I want as my new Anchor //
GameObject searchField = GameObject.Find("UI_InfinityScroller/SearchUser");
Transform s = searchField.transform;

// The gameobject in which i want the new Anchor Point //
UIPanel test = GameObject.Find("UI_InfinityScroller/ScrollView").GetComponent<UIPanel>();
test.topAnchor.target = s;

This does nothing. it does not change my topAnchor? I am not sure what i am doing wrong and any help is appreciated.

Thanks in advance :-)

Rune Vejen Petersen
  • 3,201
  • 2
  • 30
  • 46
Mansa
  • 2,277
  • 10
  • 37
  • 67
  • do you maybe have "Run only once" flagged on the anchor component? edit: oh nvm, didnt see that its a panel – Tom Aug 20 '14 at 13:54
  • What is your intended outcome here? Are you trying to resize the panel based on switching the Anchors? – Dover8 Aug 21 '14 at 10:18

0 Answers0