I've created following code which works just fine:GraphBar1.GetComponent<RectTransform> ().sizeDelta = new Vector2 (50, oScript.reactionTimeArray [0] * 1000);GraphBar2.GetComponent<RectTransform> ().sizeDelta = new Vector2 (50, oScript.reactionTimeArray [1] * 1000);GraphBar3.GetComponent<RectTransform> ().sizeDelta = new Vector2 (50, oScript.reactionTimeArray [2] * 1000);GraphBar4.GetComponent<RectTransform> ().sizeDelta = new Vector2 (50, oScript.reactionTimeArray [3] * 1000);GraphBar5.GetComponent<RectTransform> ().sizeDelta = new Vector2 (50, oScript.reactionTimeArray [4] * 1000);GraphBar6.GetComponent<RectTransform> ().sizeDelta = new Vector2 (50, oScript.reactionTimeArray [5] * 1000);GraphBar7.GetComponent<RectTransform> ().sizeDelta = new Vector2 (50, oScript.reactionTimeArray [6] * 1000);GraphBar8.GetComponent<RectTransform> ().sizeDelta = new Vector2 (50, oScript.reactionTimeArray [7] * 1000);GraphBar9.GetComponent<RectTransform> ().sizeDelta = new Vector2 (50, oScript.reactionTimeArray [8] * 1000);GraphBar10.GetComponent<RectTransform> ().sizeDelta = new Vector2 (50, oScript.reactionTimeArray [9] * 1000);As I'm re-writing almost the same code so many times, I'm convinced this can be done using less code, even though I'm confused on how to do it with the Array properties being present.
Changing height of an UI panel using Array content
c#;unity3d
It could be written as : var graphBars = new[] { GraphBar1, GraphBar2, GraphBar3, GraphBar4, GraphBar5, GraphBar6, GraphBar7, GraphBar8, GraphBar9, GraphBar10 };for (int i = 0; i < graphBars.Length; i++)    graphBars[i].GetComponent<RectTransform>().sizeDelta =        new Vector2(50, oScript.reactionTimeArray[i] * 1000);