- Home /
Cannot change camera position (2D)
Script set camera position at player position only at start, later I can't even change it via transform in scene.
Camera change position only when I change player position via scene.
Answer by SahanD · Jun 01, 2019 at 01:13 PM
It because your script ALWAYS positioning according to your player position. That is the reason that your camera moves only when your player moves. So according to this if you want to change the position of the camera, you must disable the script first and then change the position of your camera. Disable your camera script from the inspector. @jaroslawchrobakkontakt
I know, but I want camera to follow player. Today I saw that in inspector player's coordinates are not changing when I am walking around, but green and red arrows are moving.
Sorry, don't know what happens there. try to get output in the console using debug log. if its displaying the coordinates in console probably issue with the unity. Try to do this in a new scene, and what i saw in your script is you don't want to add Camera Game Object into the script to transform your camera. just add the player Game Object and get the desired position.
public Transform target;
voidFixedUpdate() { transform.position = target.transform.position; }
Your answer
Follow this Question
Related Questions
Moving child and parent 1 Answer
How do you move the camera relative to the direction it is currently facing? 1 Answer
Smoother Camera Movement without making camera child of the player? 0 Answers
Lock Camera to be within a box type area? 1 Answer
How do I make my camera follow the player without rotating in 2D? 2 Answers