RectTransform.sizeDelta ScrollRect Child

I am currently in Unity 5.2.1f1 and I am stumped. Lately I have been learning anchors and trying to get my UI to scale nicely across multiple resolutions. I wrote myself an editor script to make this easier and more precise, and to help the anchors snap to the corners of its own rectTransform. This script uses transform.parent.gameObject.GetComponent().sizeDelta and this is where the problem lies.

When I run this script on a gameObject that is the child of an object that contains a scrollRect and a Mask (I don’t know which causes the problem), sizeDelta returns 0 every time. Is there any way around this? Are there any alternative ways to query the width and height of a parent’s rectTransform?

transform.parent.gameObject.GetComponent().rect.width or height both work. I had seen this as an answer on other questions, however, for some reason auto complete in VS was not showing this as an option and threw me off. Randomly it began showing in the auto complete some time later and has worked fine since.