[Unity 4.6 beta] Changing anchors position through script

Hi, I am in situation when I need to change button anchors position from script. Currently my anchors are located exactly in the button corners (because I want this button to be scalable when changing screen size) and I would like to move it to the parents element top left corner (practically use anchor preset “top-left”). My answer is how can I achieve this through script? I`ve tried to change anchors min-max setting to the values which are displayed in inspector when you select Top-Left preset and I did it like this:

RectTransform rt = myButton.GetComponent<RectTransform>();
rt.anchorMin = new Vector2(0, 1);
rt.anchorMax = new Vector2(0, 1);

Problem is the anchor position has really moved to parents top-left corner, but my button completely disappeared (yeah, just disappeared, it is not located anywhere in the scene). This leads me to conclusion that I need to change more rectTransform variables to reach my goal… Can somebody please help?

I know it is too late, but it might help someone else facing the same problem.

Before altering the anchor points (anchorMin and anchorMax), you can store the world position (and also any other properties if needed) of the RectTransform to a temporary variable and use it to restore the values after altering.

For Ex:

			rectTransform = (RectTransform) transform;

			// Storing the current position in a temporary variable
			Vector3 tempPos = rectTransform.position;

			// Changing the anchor points to left bottom corner
			rectTransform.anchorMax = Vector2.zero;
			rectTransform.anchorMin = Vector2.zero;

			// Restoring the position to overcome movement of the transform due to anchor point movement
			rectTransform.position = tempPos;