Here is my code to create lines for graph in Start():
for (float i = 0.1f; i <= 0.9; i = i + 0.08f)
{
UILineRenderer xLine = (UILineRenderer)Instantiate(renderer1);
xLine.tag = "XLenghtLine";
xLine.transform.parent = this.transform;
xLine.transform.localPosition = new Vector3(0.5f, 0.5f, 0);
xLine.GetComponent<RectTransform>().sizeDelta = this.GetComponentInParent<RectTransform>().sizeDelta;
xLine.GetComponent<RectTransform>().localRotation = Quaternion.identity;
xLine.GetComponent<RectTransform>().localScale = new Vector3(1, 1, 1);
var pointList = new List<Vector2>(xLine.Points);
Vector2 first = new Vector2(0.1f, i);
Vector2 second = new Vector2(0.8f, i);
pointList.Add(first);//dodanie punktu do listy
pointList.Add(second);//dodanie punktu do listy
xLine.Points = pointList.ToArray();
xLine.rectTransform.anchorMin = new Vector2(0, 0);
xLine.rectTransform.anchorMax = new Vector2(0, 0);
}
Then when I add graph values I want to extend lines lenght, using this code:
Transform parentTransform = this.transform;
foreach (Transform child in parentTransform) if (child.CompareTag("XLenghtLine"))
{
child.GetComponent<UILineRenderer>().Points[1].x = this.GetComponent<TextReader>().prices.Count * indexStep + SpaceForYaxis;
}
When I run game I can see in inspector that value changes as it should, but the change doesn’t show up in editor. Here is a screen that will better explain my issue: