I started making an FPS game 2 days ago using tutorials on the internet and I have a problem with some of my code. This script was shown on a tutorial but when I used it I got an error In-Game. This is the code.
var cameraObject : GameObject;
@HideInInspector
var targetXRotation : float;
@HideInInspector
var targetYRotation : float;
@HideInInspector
var targetXRotationV : float;
@HideInInspector
var targetYRotationV : float;
var rotateSpeed : float = 0.3;
var holdHeight : float = -0.5;
var holdSide : float = 0.5;
function Update ()
{
transform.position = cameraObject.transform.position + (Quaternion.Euler(0,targetYRotation,0) * Vector3(holdSide, holdHeight, 0));
targetXRotation = Mathf.SmoothDamp( targetXRotation, cameraObject.GetComponant(MouseLookScript).xRotation, targetXRotationV, rotateSpeed);
targetYRotation = Mathf.SmoothDamp( targetYRotation, cameraObject.GetComponant(MouseLookScript).yRotation, targetYRotationV, rotateSpeed);
transform.rotation = Quaternion.Euler(targetXRotation, targetYRotation, 0);
}
The script seems to work because my gun follows the mouse in-game, but i get this error multiple times in my console when i play.
MissingMethodException: Method not found: 'UnityEngine.GameObject.GetComponant'.
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher ()
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create ()
Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object[] args)
Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target, System.String name, System.Object[] args)
Boo.Lang.Runtime.RuntimeServices+<Invoke>c__AnonStorey12.<>m__6 ()
Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key,
If anyone needs more evidence to help fix this then ask and I will post. Please answer ASAP!