Javascript problem on Unity iPhone

I have a problem.
I imported a project made on Unity to Unity iPhone and all works fine except one line of code.

The code works fine in regular Unity.

var RelativeWaypointPosition : Vector3 = transform.InverseTransformPoint( Vector3(waypoints[currentWaypoint].position.x, transform.position.y,	waypoints[currentWaypoint].position.z ) );

I get the following error:
“position’ is not a member of ‘Object’”.

I anyone has some tips it would be helpful.

/Peter

you need to explicitly cast what a waypoint is. There is no dynamic type programming for iPhone.

(waypoints[currentWayPoint] as wayPoint).position.x

for example. replace wayPoint with whatever the object type in waypoints[ ] is.

If it is just a bunch of transforms it would be

(waypoints[currentWayPoint] as Transform).position.x

Thanks a lot!
I had a feeling that I had to do a more specific cast but I had no idea how to do :slight_smile:

Thanks again.