how can i set float x for example for only the horizontal velocity of an object?
in C# btw
Vector3 tempVector = GetComponent().velocity;
tempVector.x = 10f;
GetComponent().velocity = tempVector;
If what you want is to “read” the horizontal velocity of an object, you may simply cast it to a Vector2.
((Vector2) GetComponent<Rigidbody>().velocity).x