Hi,
I have the following code:
IEnumerator Populate(string part) {
GameObject newItem = (GameObject)Instantiate (ItemPrefab);
UISprite image = newItem.GetComponent<UISprite>();
image.spriteName = "Head";
image.MakePixelPerfect();
image.width = image.width/4;
image.height = image.height/4;
newItem.SetActive(true);
Debug.Log (newItem.transform.position);
newItem
.transform.position = new Vector3
(1000f,1000f,1000f
); Debug.Log (newItem.transform.position);
yield return new WaitForSeconds
(1); Debug.Log (newItem.transform.position);
}
The three debug logs return the following (in order):
(-128.0, 49.0, 0.0)
(1000.0, 1000.0, 1000.0)
(22.6, 3.1, -7.0)
So AFTER the yield (the wait for 1 second), the position of the object is getting updated automatically. If I set the position of the object AFTER the 1 second, the position sticks. Please explain this to me.