Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created March 1, 2018 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/31aefb8972ce0cc6655e271780c144af to your computer and use it in GitHub Desktop.
Save tsubaki/31aefb8972ce0cc6655e271780c144af to your computer and use it in GitHub Desktop.
カメラが対象を追跡する
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FollowCamera2D : MonoBehaviour {
[SerializeField] Transform target;
private Vector3 offset = new Vector3(0, 0, -10);
void LateUpdate ()
{
transform.localPosition = target.position + offset;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment