- Home /
Question by
KillbunnyuK · Sep 12, 2012 at 09:52 PM ·
disable
Disabling Scripts
Hi everyone.
I'm trying to disable the Mouse Look script on a game I'm making for the user can use a GUI. The problem I'm having is that when I type this script up it keeps giving me an error saying the MouseLook is an unknown identifier. I did get this code from the internet but it seemed to work for the person who posted it. The Mouse Look script is on a own made player model it isn't on the First Person Prefab that comes with Unity.
If anyone could help that would be awsome :).
var Dialog : boolean = true;
function Start () {
}
function Update () {
if(Input.GetKeyUp(KeyCode.F) && Dialog )
{
GetComponent(MouseLook).enabled = false;
Dialog = false;
}
else if (Input.GetKeyUp(KeyCode.F) && Dialog == false)
{
GetComponent(MouseLook).enabled = true;
Dialog = true;
}
}
Comment
Answer by PProductions · Sep 13, 2012 at 05:49 PM
Try using:
GetComponent(typeof(MouseLook)).enabled = false;
also the MouseLook script needs to be in your project... though I presume this is true.
Your answer
![](https://koobas.hobune.stream/wayback/20220613080948im_/https://answers.unity.com/themes/thub/images/avi.jpg)