I am new to coding and unity, so the answer may be so simple.
Please see the code below. I am not sure why I am getting two different vectors.
using UnityEngine;
using System.Collections;
public class test : MonoBehaviour {
public Vector3 position;
// Use this for initialization
void Start () {
position = transform.position;
}
// Update is called once per frame
void Update () {
print (position); //I am getting >>> (4.5, 2.3, 0.0)
print (transform.position);//I am getting >>>(4.6, 2.3, 0.0)
}
because the position you retrive in Start() doesnt cahnge over time. but transform.position does.
im willling to bet one of those values always stays the same correct?
adding :
position = transform.position;
Do you have another script or anything affecting the position of the object using this script? Like the other guy said, start is only called one time ever when the script first starts, and you are saving in a variable the starting values of the Vector 3. Update is called all the time. Somewhere down the line the coordinates of your object are changing and hence, they are not the same as the starting ones.