NullReferenceException: Object reference not set to an instance of an object
StarterAssets.ThirdPersonController.Move () (at Assets/Scripts/ThirdPersonController.cs:258)
StarterAssets.ThirdPersonController.Update () (at Assets/Scripts/ThirdPersonController.cs:161)
from 155 to 161 line:
private void Update()
{
_hasAnimator = TryGetComponent(out _animator);
JumpAndGravity();
GroundedCheck();
Move();
from 257 to 265
{
_targetRotation = Mathf.Atan2(inputDirection.x, inputDirection.z) * Mathf.Rad2Deg +
_mainCamera.transform.eulerAngles.y;
float rotation = Mathf.SmoothDampAngle(transform.eulerAngles.y, _targetRotation, ref _rotationVelocity,
RotationSmoothTime);
// rotate to face input direction relative to camera position
transform.rotation = Quaternion.Euler(0.0f, rotation, 0.0f);
}
What causes the error?