I want to rotate an gameobject around the y-axis with the vector.
I have Vector3 (1f, 0,1f), and I want to get an object rotated in the plane xz at 45 degrees, how?
I read the reference on the rotation, but did not understand how to do it,
The simplest way to do this is to assign your vector normalized to transform.forward:
transform.forward = myVector.normalized;
transform.forward indicates the forward direction from the object’s point of view, and can be read or set.
But if you really need to get the transform.rotation (a quaternion) you can do this:
var rot = Quaternion.FromToRotation(Vector3.forward, myVector);
rot will be a quaternion corresponding to the rotation from (0, 0, 1) to your vector, and if assigned to transform.rotation will rotate the object to the direction your vector is pointing to.
Also, you could check out iTween on the Asset store
iTween.RotateTo(GameObject, Vector3, float);
Vector3 being your rotation, this will allow you to do complex rotations easily.