Why use two transform?

List waypoints;
The teacher’s code:
transform.position = waypoints[wayPointIndex].transform.position;

and my is:
transform.position = waypoints[wayPointIndex].position;

I think the waypoints is type of transform so I wrote in that way.
I wander what is the difference between my code and teacher’s code.

2 Likes

Hi Mado,

Your solution is perfectly fine. Rick made a little “mistake” here by adding the redundant transform. It’s not a real mistake as the code works, but it’s definitely improvable.

Feel free to keep your solution if you want. :slight_smile:

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms