Modifying position,scale,velocity etc. directly

Hello, I’ve noticed something strange when modifying vectors such as transform.position, transform.localScale, rigidbody2D.velocity etc. directly. By that I mean typing something such as

transform.localScale = new Vector3(10,1,0);

or

rigidbody2D.velocity = new Vector2(10,0);

instead of doing

transform.localScale += new Vector3(10,1,0);

rigidbody2D.velocity += new Vector2(10,0);

In the first case for example, the scale of child objects attached to the parent is completely messed. In the second case I was trying to move an object only horizontally: velocity.y is always be 0. However if I directly assign a Vector2(1,0) my object will move very slowly. If I choose to add this Vector2 to the existing velocities everything is fine.

Can someone explain to me why assigning new Vectors directly can cause problems while adding the same vectors seems to work fine. Both methods can produce the same results but for some reason the first one causes many problems.

A Vector3 expects floating-point parameters, so try:

transform.localScale = new Vector3(10f, 1f, 0f);

etc.