Skip to content

Instantly share code, notes, and snippets.

@chomado
Last active December 7, 2017 03:07
Show Gist options
  • Save chomado/b18bd4cb6668dbfc5a1466659688c8f7 to your computer and use it in GitHub Desktop.
Save chomado/b18bd4cb6668dbfc5a1466659688c8f7 to your computer and use it in GitHub Desktop.
Playerに追従するカメラ
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour
{
public GameObject Player;
private Vector3 offset;
// Use this for initialization
void Start()
{
this.offset = this.transform.position - this.Player.transform.position;
}
void LateUpdate()
{
this.transform.position = this.Player.transform.position + this.offset;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment