So, I try to instantiate one of my image, and try to set the position as I wish. However, it doesn’t work, and the position just went off. Here’s my code:
Start ()
{
heartList = new List<Image> ();
for (int i = 0;i < heartNum;i++)
{
heart = Instantiate (heartPrefab) as Image;
heart.transform.SetParent (canvas, false);
heart.transform.localPosition = new Vector3 (heartX + (heartSpacingX * i), 0, 0);
heartList.Add (heart);
}
}