Iphone 2D platform tutorial scripting question

Hello,

I’m just modifying and adding with Unity tutorial (2D and 3D tutorials found on the unity site).

But some of script of that does not work with Unity-iPhone. I know Unity-iPhone does not support dynamic type but what’'s the following error about?

error:
Assets/Scripts/2D/LevelAttributes.js(48.21):'size’is not a member of ‘UnityEngine.Component’.

leftBoundary.AddComponent (BoxCollider);
		
boxCollider.size = Vector3 (colliderThickness, bounds.height + colliderThickness * 2.0 + fallOutBuffer, colliderThickness);

Is it not the instance of BoxCollider which is the return value of AddComponent?

Also I tried the follwings but same result:

leftBoundary.AddComponent (BoxCollider);
	
boxCollider = leftBoundary.GetComponent(BoxCollider);
	
boxCollider.size = Vector3 (colliderThickness, bounds.height + colliderThickness * 2.0 + fallOutBuffer, colliderThickness);

I used GetComponent but no effect on that.

Thank you for any help and reply.

-Kim

well Component does not contain it.

JS on iphone is statically typed, not dynamic typed.
So you must assign the retrieved component to a variable of the correct type.

Thank you!

Solved the problem with adding var boxCollider : BoxCollider as the following:

leftBoundary.AddComponent (BoxCollider);
	
var boxCollider : BoxCollider = leftBoundary.GetComponent(BoxCollider);
	
boxCollider.size = Vector3 (colliderThickness, bounds.height + colliderThickness * 2.0 + fallOutBuffer, colliderThickness);

Thank you for the answer.