Bokaii
1
Vector3 pos;
void Update(){
if(Input.GetKeyDown(KeyCode.E)){
pos = transform.parent.position;
pos.z += 2;
}
}
Why does this not work???
rutter
2
When you access the transform’s position, that is “passed by value”. You get a copy of the original value, and changes made to the copy won’t directly alter the original.
You can modify the value and assign a new position:
pos = transform.parent.position;
pos.z += 2;
transform.parent.position = pos;