'position' is not a member of 'Object' error

Hi. I have a problem with this Assets/Scene/Script/PathScript.js(20,22): BCE0019: ‘position’ is not a member of ‘Object’. what should I do, sorry I’m only a newbie here…

var path : Array;
var rayColor : Color = Color.white;


function OnDrawGizmos(){
Gizmos.color = rayColor;

var path_objs : Array = transform.GetComponentsInChildren(Transform);
path = new Array();

for (var path_obj : Transform in path_objs){
	if(path_obj != transform)
		path [path.length] = path_obj;
}
for (var i : int = 0; i < path.length; i++){
var pos : Vector3  = path*.position;*

if(i>0){
var prev = path[i-1].position;
Gizmos.DrawLine(prev,pos);
Gizmos.DrawWireSphere(pos,1.0);
}
}
}

Here is an untested conversion of your Array to a generic list in the code above:

#pragma strict

var path : List.<Transform> = new List.<Transform>();  
var rayColor : Color = Color.white;
 
function OnDrawGizmos() {
	Gizmos.color = rayColor;
    path.Clear();
	 
	var path_objs = transform.GetComponentsInChildren(Transform);
	 
	for (var path_obj : Transform in path_objs) {
	    if(path_obj != transform && path_obj != null)
	       path.Add(path_obj);
	}
	
	for (var i : int = 0; i < path.Count; i++) {
		var pos : Vector3  = path*.position;*
  •  if( i > 0) {*
    
  •  	var prev = path[i-1].position;*
    
  •  	Gizmos.DrawLine(prev,pos);*
    
  •  	Gizmos.DrawWireSphere(pos,1.0);*
    
  •  }*
    
  • }*
    }
    Do you lose or gain children over time? If not, build ‘path’ in Start() rather than build it for every OnDRawGizmos() call.