- Home /
MissingMethodException: Method not found- Error on fps script
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!
Answer by DaveA · Apr 11, 2012 at 12:36 AM
"GetComponant" - should be spelled "GetComponent"
Thanks I guess that $$anonymous$$ches me for not being careful enough
Common error. BTW: This is more of a comment on my answer, not an answer itself. Please use the 'add new comment' button in the future. It's also good form to use the checkmark to the left of an answer that satisfies your question, so we know it's been answered.
Your answer
Follow this Question
Related Questions
Webplayer exception when using BufferedStream 0 Answers
Missing Reference Error 1 Answer
Animation CrossFade Help Missing Method 1 Answer
Unassigned Reference Exception ? 0 Answers