using UnityEngine; public class TargetLocker : MonoBehaviour { public enum UpdateType { update = 0, late = 1, fixedUpdate = 2 } public UpdateType type; public Transform target; public Vector3 Offset; public Quaternion RotationOffset; private void UpdatePosition() { target.GetPositionAndRotation(out var position, out var _); base.transform.position = position; } private void Update() { if (type == UpdateType.update) { UpdatePosition(); } } private void FixedUpdate() { if (type == UpdateType.fixedUpdate) { UpdatePosition(); } } private void LateUpdate() { if (type == UpdateType.late) { UpdatePosition(); } } }