# What is the difference between vector2 and position?

Is vector2 simply a container with x and y coordinates, and is there a move function?
vector2(10,10)

and why position is can not change x and y as directly?
i get error by this
position.x +=10
this is ok
positon =new Vector2(10,10)

Hello @blendegg

Its simple,

Vector2 is a type of variable, like int, float, bool, string …

Position is a value of a gameobject (Transform component of an object contains the position value, and rotation and scale)

Position in a 2D world, have 2 coordinates, so a VEctor2 variable is used to define the position. In a 3D world, position is represented as a Vector3 variable (X, y, Z)

Its like, a intensity of a light is represented with a int variable, or a name of an object is represented with a string type variable.

Bye!

I’m probably not the best person to answer this question since I’m also pretty new to Unity and C#, so if I’m wrong, I’m sorry, someone correct me.
My understanding is that a Vector2 is essentially a variable that stores 2 values, and the position is a vector (I think it’s actually a Vector3 which stores 3 values because Unity is a 3D program, though if you’re making a 2D game the z axis isn’t super important) that is automatically created for game objects in your scene. I don’t think you can edit it using the position vector, I believe the position vector is just there for calculations.
For movement functions I think you can use Transform.translate (or whatever other transformation you want to do), but I think the preferred way to do it is by applying forces with rigidbodies (which are used for physics).
For a better answer I’d look up some tutorials on 2D player movement, I’m sure there’s plenty of great ones.

Thank you
I may have understood a little bit