I’m using Unity3D, my array contains 7 GameObjects, they queued on a line." I need help to write the funtion “SimpleMov” to make the first object assume the 7th position, the 2 object to assume the 1 position, etc.
On Unity the gameobjects are associated on unity’s interface, the arrays are full with 7 positions each.
i would like your help to make the function move this objects. Thank you.
using UnityEngine;
using System.Collections;
public class StairsController : MonoBehaviour {
public GameObject[] degrau;
Vector3[] positionArray = new Vector3[7];
private int i = 6;
private int a = 6;
// Use this for initialization
void Start () {
positionArray [i-6] = degrau[a-6].transform.position;
Debug.Log (positionArray [i-6]);
positionArray [i-5] = degrau[a-5].transform.position;
Debug.Log (positionArray [i-5]);
positionArray [i-4] = degrau[a-4].transform.position;
Debug.Log (positionArray [i-4]);
positionArray [i-3] = degrau[a-3].transform.position;
Debug.Log (positionArray [i-3]);
positionArray [i-2] = degrau[a-2].transform.position;
Debug.Log (positionArray [i-2]);
positionArray [i-1] = degrau[a-1].transform.position;
Debug.Log (positionArray [i-1]);
positionArray *= degrau[a].transform.position;*
Debug.Log (positionArray );
}
public void SimpleMov (){
degrau [a].transform.position = positionArray [i - 1];
}
}