20 lines
428 B
C#
20 lines
428 B
C#
using UnityEngine;
|
|
|
|
public class Follow : MonoBehaviour
|
|
|
|
{
|
|
public Transform target;
|
|
private Vector3 offset;
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
void Start()
|
|
{
|
|
offset = transform.position - target.position;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
transform.position = target.position + offset;
|
|
}
|
|
}
|