So I have this code ( I know there are better ways to do this but I just have one thing in mind) Let's say I have this:
void Update(){
transform.position += transform.forward*2f*Time.deltaTime;
}
This works perfectly fine but if I get a reference to this, it does not work. for example
Vector3 _objPosition;
void Start(){
_objPosition = this.gameObject.transform.position;
}
void Update(){
_objPosition += transform.forward*2f*Time.deltaTime;
}
And this does not work so my question is why can't we get a reference to an object's position, scale, rotation like other components but instead we can only get the value? which why the first code above works but the one below does not