- Home /
 
Persistent mouselook disabling error?
I get the error that mouselook does not contain enabled. Please I need to know why it is not working. What I`m trying to do is disable FPS camera from moving around with the mouse cursor while chatting with an NPC so that I can click on buttons without much movement. Thank you in advance.
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityStandardAssets.Characters.FirstPerson;
 
 
 public class look1 : MonoBehaviour {
    private MouseLook[] mLooks;
     // Use this for initialization
     void Start () {
         GameObject player = GameObject.FindWithTag("Player");
         // and get its 2 MouseLook scripts in mLooks:
         mLooks = player.GetComponentsInChildren<UnityStandardAssets.Characters.FirstPerson.MouseLook>();
         
         foreach (MouseLook mLook in mLooks){
             // enables MouseLook when showGUI is false and vice versa
             mLook.enabled = false; 
           }
     }
     
     // Update is called once per frame
     void Update () {
         
     }
 }
 
               ,I started unity and c# about 3 weeks ago. I get this persistent error while trying to disable mouselook while chatting with NPC.
Your answer
 
             Follow this Question
Related Questions
An object reference is required for non-static field, method, or property 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
"Only assignment, call, increment, decrement and new object expressions can be used as statements" 1 Answer
I need help referencing another script so I can disable it (C#) 1 Answer