My code isn't working please help.

So I’m a beginner with unity and c#. I am watching a brackets tutorial on how to make a simple game.
I have written this code here which is supposed to bring my main camera to the position of my player.

public class Camarafolow : MonoBehaviour
{
public Transform player;
void Update()
{
transform.postion = player.position;
}
}

the code is supposed to 1. make a variable for me to drag the Transform component into and 2. change the position of the camera to the position of the player. but when I save the script and open unity the script component just looks like this 6193200--679191--upload_2020-8-11_20-34-59.pngand does not have the extra variable slot for me to drag the transform component into. I hope this made sense.
Thanks

you wrote incorrectly position you wrote "postion"

2 Likes

As @raarc said, you have a typo in your script. That probably means you have a compiler error. If you have a compiler error nothing is going to update for you until you fix it. Check your Unity console window for red error messages.

1 Like

Thanks so much to the both of you. I fixed the spelling mistake and it ended up working. i feel so stupid now XD.

Welcome Mr Begginner! Come on back if you have any other issues.

How to report problems productively in the Unity3D forums:

http://plbm.com/?p=220

Also, be sure to use the correct code tags: https://discussions.unity.com/t/481379

OK :smile:.