- Home /
Question by
Devlin-Hu · Sep 11, 2016 at 05:01 PM ·
transform.position
get a gameobject position from vector3 array?
Hi, I have an Vector3 typer array, like this: vectorArray = {Vector1, Vector2, Vector3......}. Now, I create a gameObject and I want it transforms as vectorArray----- gameObject's position get from vectorArray.
Comment
So, what exactly is your problem?
myGameObject,transform.position = vectorArray[2];
Answer by RustyCrow · Sep 11, 2016 at 08:04 PM
Are you asking for something like this :
public class PosFromVec3Array : MonoBehaviour {
Vector3[] test = { new Vector3(1,1,1), new Vector3(2,2,2) };
// Use this for initialization
void Start ()
{
this.gameObject.transform.position = test[0];
}
}
Your answer
