- Home /
UnityEngine has no appropriate version problem
I'm following a tutorial and it has me type this:
` var PlayerTransform : Transform; var RotationSpeed : float; var PlayerCamera : GameObject; var PlayerGameObj : GameObject;
//Targets
@HideInInspector
var TargetXrotation = float;
@HideInInspector
var TargetYrotation = float;
@HideInInspector
var TargetXrotationV = float;
@HideInInspector
var TargetYrotationV = float;
function Update ()
{
transform.position = PlayerCamera.transform.position + (Quaternion.Euler(0,TargetYrotation,0)* Quaternion.Euler(TargetXrotation,TargetYrotation,0) * Vector3(0,0,0));
TargetXrotation = Mathf.SmoothDamp(TargetXrotation, -PlayerCamera.GetComponent(MouseLook).rotationY,TargetXrotationV,RotationSpeed);
TargetYrotation = Mathf.SmoothDamp(TargetYrotation, PlayerCamera.GetComponent(MouseLook).RotationX,TargetYrotationV,RotationSpeed);
transform.rotation = Quaternion.Euler(TargetXrotation,TargetYrotation,0);
}
and the problem that I get is this:
Assets/Scripts/GunScript.js(22,81): BCE0023: No appropriate version of 'UnityEngine.Quaternion.Euler' for the argument list '(int, System.Type, int)' was found.
5 times and each one is just a little bit different
thanks for the help, its probably pretty obvious but i'm very new to javascript and unity3d (hence why i'm using tutorials)
Answer by Graham-Dunnett · Jun 22, 2013 at 04:29 PM
The Euler
function takes three parameters, and each of them are floats
. In your code (line 17 in the code above) the second argument has no type specified, and that is the problem you have. You code should be:
var TargetXrotation : float = 0.0f;
and so on for each variable. This tells the compiler that your variable is a float. I'm astonished that the compiler lets you use an equals sign there.