Simple follow script

Fortunately, I had been researching this just the other day for a mobile game I’m working on, although I didn’t use LateUpdate() or use the tags, just declare a player transform and drag the Player object into the scripts value field.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraFollow : MonoBehaviour {

    public Transform player;

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

Ill have to update my mobile game code to use LateUpdate() in future…

2 Likes

Privacy & Terms