In the Unity 2019.1.14 f1, I build an Android App to test. When I add the dot to create a line chart or add text. It always to log the error “Trying to add Dot(Clone) (UnityEngine.UI.Image) for graphic rebuild while we are already inside a graphic rebuild loop. This is not supported.” Even my script count correctly position, the graph is not changed to the counted position.
But In the Unity Editor is correct. The graph can be changed to counted position.
Somebody can help me?
This’s my script:
for (int i = 0; i < valueList.Count; i++)
{
float xPos = ((i + 1) / xMaximum) * graphWidth;
float yPos = ((valueList - yMinimum) / (yMaximum - yMinimum)) * graphHeight;
GameObject circleGameObject = Instantiate(dotPrefab);
gameObject.transform.SetParent(graphContainer,false);
RectTransform rectTransform = gameObject.GetComponent();
rectTransform.anchoredPosition = new Vector2(xPos,yPos);
if (lastCircleGameObject != null)
{
CreateDotConnection(lastCircleGameObject.anchoredPosition,circleGameObject.anchoredPosition);
}
lastCircleGameObject = circleGameObject;
}