I dont get what the error means:
Assets\PlayerMovement.cs(12,49): error CS0664: Literal of type double cannot be implicitly converted to type ‘float’; use an ‘F’ suffix to create a literal of this type
Heres my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
//Made Using this tuturial
//Makes the _speed Variable show up in unity
[SerializeField] private float _speed = 7;
[SerializeField] private float _mouseSensitivty = 50f;
[SerializeField] private float _minCameraview = -70f, _maxCameraview = 80f;
[SerializeField] private float _mouseXToY = 1.25;
private CharacterController _characterController;
private Camera _camera;
private float xRotation = 0f;
// Start is called before the first frame update
void Start()
{
_characterController = GetComponent();
_camera = Camera.main;
//Check if this Script is attached to the Player object
if (_characterController == null)
Debug.Log(“No Character Controller attached to Player”);
Cursor.lockState = CursorLockMode.Locked;
}
// Update is called once per frame
void Update()
{
//Get wasd input for player
float horizontal = Input.GetAxis(“Horizontal”);
float vertical = Input.GetAxis(“Vertical”);
//move player on wasd input
Vector3 movement = Vector3.forward * vertical + Vector3.right * horizontal;
_characterController.Move(movement * Time.deltaTime * _speed);
//Get Muose position input
float mouseX = Input.GetAxis(“Mouse X”) * _mouseSensitivty * Time.deltaTime;
float mouseY = Input.GetAxis(“Mouse Y”) * _mouseSensitivty * Time.deltaTime;
//rotate Camera based on Yinput
xRotation -= mouseY;
//xRotation = xRotation - mouseY same as xRotation -= mouseY
//clamp the cam rotation betwenn 80 and -70 degrees
xRotation =Mathf.Clamp(xRotation, _minCameraview, _maxCameraview);
_camera.transform.localRotation = Quaternion.Euler(xRotation, 0, 0);
//rotate Body and Camera based on Xinput
transform.Rotate(Vector3.up * mouseX * _mouseXToY);
//
}
}