In unity script manual there is this script:
var other : Transform;
if (other) {
var dist = Vector3.Distance(other.position, transform.position);
print ("Distance to other: " + dist);
}
now, how to don’t drag the object for “var other : Transform;” in to inspector but indicate it only with the script?
I have tried:
var other : Transform = GameObject.Find("First Person Controller");
if (other) {
var dist = Vector3.Distance(other.position, transform.position);
print ("Distance to other: " + dist);
}
but
“Cannot convert UnityEgine.GameObjiect to UnityEngine.Transdorm”
Sorry for the noob question