Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by mastercatyt0 · May 14, 2020 at 12:57 PM · scripting problemerror messagescripting beginner

Cant add script becuase of error

every time i try to attach my script to a sphere (im taking a class), i get the error message that says "Can't add script component 'move' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match." i have tried many things from retyping my code and deleting things but i dont know how to fix this. ill put my code so you might be able to see what is wrong. my names match too.

 using System.Collections;
  using System.Collections.Generic;
  using System.Net.Sockets;
  using UnityEngine;
  
  public class Move : MonoBehaviour
  {
      // Start is called before the first frame update
      void Start()
      {
          
      }
  
      // Update is called once per frame
      void Update()
      {
          transform.Translate(Input.GetAxis("Horizontal"), 0, 0);
      }
  }
Comment
Add comment · Show 14
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hellium · May 13, 2020 at 04:38 PM 1
Share
  • Is the file named $$anonymous$$ove.cs (not move.cs)?

  • Do you have any other error in the console?

avatar image mastercatyt0 Hellium · May 14, 2020 at 01:14 PM 0
Share

it is named "$$anonymous$$ove". i even checked. i don't think i have any errors. nothing is underlined in red. ive followed videos and i have deleted the file and created a new one but it stayed as the same error.

avatar image Hellium mastercatyt0 · May 14, 2020 at 01:49 PM 1
Share

i don't think i have any errors. nothing is underlined in red

Look at Unity's console tab to check whether you have compiling errors.

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Dizy · May 14, 2020 at 02:43 PM

That's a basic error, some basic guidelines to fix that :

  1. Check your Class name and file name

  2. Recompile and check IDE output

  3. Add namespace based on file location

  4. Check if you dont have another file with the same name

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image mastercatyt0 · May 14, 2020 at 03:02 PM 0
Share

@Dizy my class and file name match and im following along a class and i named the file the same as the class said to and the $$anonymous$$cher didnt run into any errors. Ill try to recompile and check the output. can you tell me how to do that? im new to Unity sorry.

avatar image
0

Answer by CSPAG · May 14, 2020 at 09:01 PM

I have a feeling the names don't match, they are case and space sensitive. I can see in the code you have an upper case Move public class Move : MonoBehaviour

but in the error message you have a lower case move

Can't add script component 'move'

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hellium · May 14, 2020 at 09:06 PM 0
Share

You are 30 hours late (see comments)

avatar image CSPAG Hellium · May 14, 2020 at 09:12 PM 0
Share

my bad XD.

avatar image mastercatyt0 CSPAG · May 18, 2020 at 02:51 PM 0
Share

both of the names start with an uppercase $$anonymous$$. there is no space in the "$$anonymous$$ove" file.

avatar image mastercatyt0 · May 15, 2020 at 01:42 PM 0
Share

i think i forgot to type an upper case "$$anonymous$$ove" in the error message. i know it is upper case either way. thanks for the help though.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

313 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

The script I copied from the Summer 2020 Week 1 Tutorial, not working for me... 0 Answers

An instance of type 'UnityEngine.Behaviour' is required to access non static member 'enabled'. 0 Answers

Upon loading a new Scene I got The object of type has been destroyed but you are still trying to access it. 0 Answers

Need help fixing error (NullReferenceException: Object reference not set to an instance of an object) 1 Answer

Making enemy AI waypoints HELP! 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges