Assets/Scripts/connector_link.js(7,29): BCE0051: Operator '-' cannot be used with a left hand side of type 'UnityEngine.GameObject' and a right hand side of type 'UnityEngine.GameObject'. ERROR HELP!

I have this error… Assets/Scripts/connector_link.js(7,29): BCE0051: Operator ‘-’ cannot be used with a left hand side of type ‘UnityEngine.GameObject’ and a right hand side of type ‘UnityEngine.GameObject’.

This is the code I have so far…

#pragma strict
var v3Start : GameObject;
var v3End : GameObject;

function Start () {
                                      // Position it
transform.position = (v3End - v3Start)/2.0f + v3Start; 
 
var v3T = transform.localScale;      // Scale it
v3T.y = (v3End - v3Start).magnitude;
transform.localScale = v3T;
 
                                      // Rotate it
transform.rotation = Quaternion.FromToRotation(Vector3.up, v3End - v3Start);


}

function Update () {

}

function connect(node1, node2){
//var distance = 

//sphere1.transform.scale.x
} 

Thanks for any help or suggestions!!! :smiley:

Change your variables to Transform:

var v3Start : Transform;
var v3End : Transform;

Instead of v3End you have to use v3End.position. Same for v3Start.

Don’t forget to re-assign your objects.