when i try to comply a script for aiming down sights from a tutorial i keep gettin errors eventhough its word perfect can someone plz help!
GetComponent returns a Component, and Components do not have a sensitivityX member.
You need a MouseLook.
The most best way to get a MouseLook is:
object.GetComponent(MouseLook)
Other ways are:
var ml : MouseLook = object.GetComponent< MouseLook >();
and
var ml : MouseLook = object.GetComponent("MouseLook") as MouseLook;
but not
var ml = object.GetComponent("MouseLook");
, because that returns a Component.
The string method is the slowest and easiest to mess up; you’ll save yourself lots of headaches if you only use it if your code is given a string variable to send in.
You can also add #pragma strict
at the top of your script - this will force you to use variable types and prevent a lot of these auto-typing issues.