Weldrik
Weldrik

Reputation: 21

Camera goes dodgy on game build

My demo works well in the editor. However, upon game build the camera follows the player differently. It appears to have a delay like it's following the animation colliders etc. Any ideas on how to fix this?

Camera script

{
public GameObject player;
public Vector3 cameraOffset;

void Start()
{
    player = GameObject.FindGameObjectWithTag("Jacko");
    cameraOffset = transform.position - player.transform.position;
}

void LateUpdate()
{
    transform.position = player.transform.position + cameraOffset;
}

}

Upvotes: 2

Views: 34

Answers (1)

Cristiano Schiaffella
Cristiano Schiaffella

Reputation: 619

If you're following you're player in Update method you can instead do it in LateUpdate method. With LateUpdate you know that this is executed always after the Update method of the player.

Upvotes: 1

Related Questions