I have six or more sprites that are hidden, alpha set to 0. I move the sprites to a starting position at the top of the screen before showing them. Once in the new position I show them and the moving them back to their original positions.
My issue is that the sprites are show just for a couple of milliseconds before they are moved to the starting point. Even though the order of the code is move first then show.
I tried to find a position moved callback to detect when the position change is complete before showing but I don't this it is possible.
void Start() {
int i = 0;
foreach (Transform point in drawingPoints.transform)
{
//Record points original postion
Vector3 currentPosition = point.transform.position;
//Move to new starting position
point.transform.position = stepOne.transform.position;
//Now show point
var color = point.gameObject.GetComponent<SpriteRenderer>().color;
color.a = 1;
point.gameObject.GetComponent<SpriteRenderer>().color = color;
//Move point back to original postion
point.transform.DOMove(currentPosition, 1f).SetDelay(UnityEngine.Random.Range(0f, 0.3f));
i += 1;
}
}