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. Dismiss Notice

Question I have a question regarding Unity 2D Platformer for Complete Beginners...

Discussion in 'Community Learning & Teaching' started by Brian-Washechek, Aug 22, 2023.

  1. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    8-21-2023 - 01.png
    Question: I need guidance. I'm completely lost on this tutorial.
     
    Last edited: Aug 22, 2023
  2. BABIA_GameStudio

    BABIA_GameStudio

    Joined:
    Mar 31, 2020
    Posts:
    488
    It's telling you that you either have an error in your script, or your class does not match the file name. You're going to have to show us your script if you want someone to have a look at it for you.
     
  3. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    Ok. I'm very willing to do whatever you ask. I just need to know what you're looking for.
     
  4. BABIA_GameStudio

    BABIA_GameStudio

    Joined:
    Mar 31, 2020
    Posts:
    488
    I thought I was pretty clear when I responded with:
    Which is exactly what the error message is telling you.

    I've asked you to show us the script that you are trying to add to the game object.

    Your class in the script needs to match the script file name, and your scripts need to have no errors in them.

    Without seeing the contents of the script we can't check anything for you.
     
  5. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    ...
    This?
     

    Attached Files:

  6. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    8-21-2023 - 02.png
    It's still giving me this.
     
  7. BABIA_GameStudio

    BABIA_GameStudio

    Joined:
    Mar 31, 2020
    Posts:
    488
    Yes.
    And opening that script it is obvious why it is not working:
    Code (csharp):
    1. public class NewBehaviourScript : MonoBehaviour
    You haven't named your class properly, just like the error message told you and I also said:
    Your class name should not be
    NewBehaviourScript
    if your file is
    PlayerMovement
    . Your class should be
    PlayerMovement


    This is just a warning, not an error, and is not related to the issue you raised where you couldn't attach the script.