Search Unity

Question Why is "type or namespace not found"

Discussion in 'Editor & General Support' started by Thomas-AJH-Dev, Jan 22, 2022.

  1. Thomas-AJH-Dev

    Thomas-AJH-Dev

    Joined:
    May 31, 2020
    Posts:
    30
    I am making a script that enables or disables the Unity Standard Assets FirstPersonController script on button click. I am getting the error "cs0246 the type or namespace FirstPersonController could not be found". I know that normally happens when you are missing a direcutive but the script is attacked to the same GameObject as the FirstPersonController script and im getting the error, have i dont something wrong?
    heres my code

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. public class StopMouse : MonoBehaviour
    5. {
    6.     // Update is called once per frame
    7.     void Update()
    8.     {
    9.         if(Input.GetKeyDown(KeyCode.Tab))
    10.         {
    11.             GetComponent<FirstPersonController>().enabled = false;
    12.         }
    13.         else
    14.         {
    15.             GetComponent<FirstPersonController>().enabled = true;
    16.         }
    17.     }
    18. }
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,752