- Home /
C# - Script can't find the mouse look script in FPSController
Hey there, I already know that there's a lot of questions like this one "How to disable mouse look" and such, but I looked at them tried them but nope there's no script that works for me, so here am I.
My problem is I want to disable mouselook on FPSController but C# can't find the component Hierarchy:
And I've tried: (PS:I renamed the FirstPersonController script to FPC)
#1 GameObject ff = GameObject.Find("FPSController);
ff.GetComponent<MouseLook>().enabled = false;
#2 GameObject ff = GameObject.Find("FPSController");
ff.GetComponent("Mouse Look").enabled = false;
and I tried to disable the script like this:
GameObject ff = GameObject.Find("FPSController);
ff.GetComponent<FDP>().enable = false;
but of course he didn't like my face and denied me because he couldn't find the script. Error: "The type or namespace name 'FDP' could not be found. Are you missing a using directive or an assembly reference?"
Last screenshot:
Thanks for trying and sorry if there's mistakes i'm an angry french C# programmer.
Did you just rename the file name of the script, or did you remember to change the class' name in the header, too?
From that picture, looks like you have a script called FPC with a mouse look script embedded inside of it? So you're going to have to add a boolean to that for disabling the mouse look (or just change sensitivity to 0 or something in whatever direction) and then look for the component FPC and disable it
ff.GetComponent<FDP>().enable = false;
Why are you trying to access a component named "FDP" if the actual script is named "FPC"? :)
@Cherno Because I'm weird and I didn't see that BUT it still doesn't work
Your answer
![](https://koobas.hobune.stream/wayback/20220613195858im_/https://answers.unity.com/themes/thub/images/avi.jpg)