I want to transform canvas raw images at certain positions inside the canvas. All raw images are starting in one position. But they also translate to a set default position. I want the images to move to a selected layout(selected points on the canvas) which will work in devices having different resolutions and give the same layout impression. How should i fix this problem?
public class WidgetMove : MonoBehaviour
{
public Vector3 sx = new Vector3 (0f, 0f, 0f);
public Vector3[] ranVecs = new Vector3[11];
public GameObject[] widgets = new GameObject[11];
public float divx, divy, srec;
// Use this for initialization
void Start()
{
divx = Screen.width;
divy = Screen.height;
srec = divx / divy;
setvalue ();
}
IEnumerator TracePaths()
{
// widgets = GameObject.FindGameObjectsWithTag("movableWidgets");
int x = 0;
yield return new WaitForSeconds(2.9f);
float duration = 2f;
foreach(GameObject gos in widgets)
{
iTween.MoveTo(gos, ranVecs[x], 3.0f);
x++;
}
yield return null;
}
public void setvalue()
{
float setx, sety = 0f;
setx = srec / 2;
int y= 0, i, j;
for (i=0; i<3; i++) {
for(j=0;j<3;j++){
sx= new Vector3(setx,sety,0f);
ranVecs[y]=sx;
StartCoroutine(TracePaths());
setx+=1.5f;
y++;
}
setx=srec/2;
sety+=1.0f;
Debug.Log(ranVecs.Length);
}
}
}
Thanks