BCE0019: 'transform' is not a member of 'Object'. Android build

BCE0019: ‘transform’ is not a member of ‘Object’.

when android build this error is happened. Pc windows build setting is right.

var ball:Rigidbody;

        ......

function MakeBall(pos){

  yield new WaitForSeconds(1);

  ball = Instantiate(tempBasketBall,pos.transform.position,pos.transform.rotation);

  ball.transform.parent = b1Parent;

  canControl1 = true;

}

The problem code is here " ball = Instantiate(tempBasketBall,pos.transform.position,pos.transform.rotation);"

I use Unity3d3.4. Who can help me? Thank you!

You have to type the “pos” variable in the function declaration.

function MakeBall(pos){ // <-wrong, pos must be typed

format the code guys. :slight_smile:

static var tempBasketBall:Rigidbody; 
var ball:Rigidbody;

var pos : Transform[]; 
var b1Parent:Transform; 
var canControl1 = true;

function Start () { ball = Instantiate(tempBasketBall, pos[0].position, pos[0].rotation); ball.transform.parent = b1Parent; }

...... ......

function MakeBall(pos){

yield new WaitForSeconds(1);

ball = Instantiate(tempBasketBall,pos.transform.position,pos.transform.rotation);

ball.transform.parent = b1Parent;

canControl1 = true; }

You need to cast your instantiated object to a GameObject.

Instantiate(tempBasketBall,pos.transform.position,pos.transform.rotation) as GameObject;

Also I don’t think you should cast your ball variable to a Rigidbody, I believe you want it as GameObject, too.