Why won't my position change with this code?

void Start(){
transform.position = new Vector3 (-3.110979f, -1.127013f, 0);
}

It isn’t changing the position of the gameobject when I press play but if I debug the x and y with debug.log(transform.position.x) it gives me the value I put in the start function. (-3.110979f) but it’s still 0 in the game.

Is that the entire contents of the class? Are you getting any errors in the console? Do you have any other scripts? Can you post a screenshot of your inspector.

i think new vector 3 will not come i am beginner tooo

1 Answer

1

This should do it…

void Start()
{
transform.translate(new Vector3(-3.110979f, -1.127013f, 0));
}

didn't work.