Created
June 16, 2019 23:05
-
-
Save SocketWeaver/774c3e8789635832f0a3e02ab7fc04d5 to your computer and use it in GitHub Desktop.
Camera follows the local player
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NetworkID networkID; | |
void Start() | |
{ | |
characterController = GetComponent<CharacterController>(); | |
animator = GetComponentInChildren<Animator>(); | |
player = GetComponent<Player>(); | |
networkID = GetComponent<NetworkID>(); | |
// set the camera's target to the local player | |
if (networkID.IsMine) | |
{ | |
CameraFollow cameraFollow = Camera.main.GetComponent<CameraFollow>(); | |
cameraFollow.Target = transform; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment