How to make a cylinder follow two sphere

Hi, i’m new and i’m trying to make a simple project in unity.
I have 3 object : a cylinder, and two spheres. I’d like to make the cylinder follow the two sphere like a sort of line through two point.
Any suggestions ?? I’ve tried to use the Quaternion.LookRotation() and the Quaternion.FromToRotation() functions but it didn’t works.


Here is a bit of code to get you started:

#pragma strict
 var sphere1 : Transform;
 var sphere2 : Transform;
function Start() {
	transform.localScale = Vector3 (0.25, 1.0, 0.25);

function Update() {
	var dir = sphere2.position - sphere1.position;
	transform.position = sphere1.position + 0.5 * dir;
	transform.localScale.y = dir.magnitude * 0.5;
	transform.rotation = Quaternion.FromToRotation(Vector3.up, dir);

You have to initialize Sphere1 and Sphere2 in the Inspector by drag and drop. Start() set the x and z to 0.25 as the width of the cylinder. Set as appropriate to your application.