void FixedUpdate() { if (player != null && !player.isDead()) { Vector2 smoothedPosition = Vector2.Lerp( transform.position, player.transform.position, smoothSpeed * Time.deltaTime); transform.position = new Vector3(smoothedPosition.x , smoothedPosition.y, zOffset); } }