hi,my english is not very good so ill be directly.i create this code with an array on it to spawn multiples balls in my game,now i
m trying to access this array in a different script,the enemy script,this enemy should move arround depending balls array`s position.here is my spawnBallContoller script:
and here`s the enemyController script:
#pragma strict
var speed:float =10;
var ball:GameObject;
function Update () {
if(spawnBallController.ballArray.transform.position.y>transform.position.y){
transform.position = new Vector3(transform.position.x,transform.position.y+0.2,0);
transform.position.y = Mathf.Clamp(transform.position.y,-3.4,3.92);
}
if(spawnBallController.ballArray.transform.position.y<transform.position.y){
transform.position = new Vector3(transform.position.x,transform.position.y-0.2,0);
transform.position.y = Mathf.Clamp(transform.position.y,-3.4,3.92);
}
}
in unity i got this error:
“transform” is not a member of unityengine.gameObject;
hope someone can understend my problem,thanks