Hi,
I have this chunk of code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseLook : MonoBehaviour {
public enum RotationAxes{
MouseXAndY = 0,
MouseX = 1,
MouseY = 2
}
public RotationAxes axes = RotationAxes.MouseXAndY;
public float sensitivityHor = 9f;
public float sensitivityVert = 9f;
public float minimumVert = -45f;
public float maximumVert = 45f;
private float _rotationX = 0;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (axes == RotationAxes.MouseX) {
transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityHor, 0);
} else if (axes == RotationAxes.MouseY) {
_rotationX -= Input.GetAxis("Mouse Y") * sensitivityVert;
_rotationX = MathF.Clamp (_rotationX, minimumVert, maximumVert);
float rotationY = transform.localEulerAngles.y;
transform.localEulerAngles = new Vector3 (_rotationX, rotationY, 0);
} else {
//both horizontal and vertical rotation
}
}
}
Nevertheless i get this compilation error in console:
Assets/Scripts/MouseLook.cs(32,17): error CS0103: The name `MathF' does not exist in the current context
Moreover, if I add Unity.Engine. to Mathf.Clamp I get:
Assets/Scripts/MouseLook.cs(32,29): error CS0234: The type or namespace name `MathF' does not exist in the namespace `UnityEngine'. Are you missing an assembly reference?
Nevertheless, according to MathF Unity 5.5 (my version) online reference MathF is contained in Unity Engine: Unity - Scripting API: Mathf
Is there something wrong with my UnityEngine library? Someone else had this issue? In past versions I had no problem about this.