Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Unity can't add one of my scripts because it can't find the script class

Discussion in 'Scripting' started by Grimlock_, Jun 7, 2022.

  1. Grimlock_

    Grimlock_

    Joined:
    Jun 7, 2022
    Posts:
    2
    I attached a image of the error. I'm trying to add a script called inputManager.cs to my player, and that error keeps coming up.
     

    Attached Files:

  2. Grimlock_

    Grimlock_

    Joined:
    Jun 7, 2022
    Posts:
    2
    NVM found an answer
     
  3. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,735
    You need to do what the error message suggests.

    First, look at your console window and ensure there are no compile errors. If there are any errors you must fix all of them before proceeding.

    Next, make sure the class name and filename match. That means if you filename is
    inputManager.cs
    your class must be defined as
    public class inputManager : MonoBehaviour